File size: 2,419 Bytes
42655bd
 
 
ad6bf46
 
9adea03
f4baa39
 
42655bd
 
e18d745
 
 
42655bd
 
 
 
7052503
42655bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
language: zh
datasets: c2m
inference:
  parameters:
    max_length: 108
    num_return_sequences: 1
    do_sample: True
widget: 
- text: "往者不可谏,来者犹可追。"
  example_title: "往来"
- text: "逝者如斯夫!不舍昼夜。"
  example_title: "誓不"

---


# 文言文 to 现代文

## Model description


## How to use
使用 pipeline 调用模型:

```python
>>> from transformers import pipeline
>>> model_checkpoint = "supermy/c2m"
>>> translator = pipeline("translation", 
		model=model_checkpoint,
		num_return_sequences=1,
		max_length=52, 
		truncation=True,)

>>> translator("往者不可谏,来者犹可追。")
[{'translation_text': '过 去 的 事 情 不能 劝 谏 , 未来 的 事 情 还 可以 追 回 来 。 如 果 过 去 的 事 情 不能 劝 谏 , 那 么 , 未来 的 事 情 还 可以 追 回 来 。 如 果 过 去 的 事 情'}]

>>> translator("福兮祸所伏,祸兮福所倚。",do_sample=True)
[{'translation_text': '幸 福 是 祸 患 所 隐 藏 的 , 灾 祸 是 福 祸 所 依 托 的 。 这 些 都 是 幸 福 所 依 托 的 。 这 些 都 是 幸 福 所 带 来 的 。 幸 福 啊 , 也 是 幸 福'}]

>>> translator("成事不说,遂事不谏,既往不咎。", num_return_sequences=1,do_sample=True)
[{'translation_text': '事 情 不 高 兴 , 事 情 不 劝 谏 , 过 去 的 事 就 不 会 责 怪 。 事 情 没 有 多 久 了 , 事 情 没 有 多 久 , 事 情 没 有 多 久 了 , 事 情 没 有 多'}]

>>> translator("逝者如斯夫!不舍昼夜。",num_return_sequences=1,max_length=30)
[{'translation_text': '逝 去 的 人 就 像 这 样 啊 , 不分 昼夜 地 去 追 赶 它 们 。 这 样 的 人 就 不 会 忘 记'}]

```
Here is how to use this model to get the features of a given text in PyTorch:

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("supermy/c2m")
model = AutoModelForSeq2SeqLM.from_pretrained("supermy/c2m")
text = "用你喜欢的任何文本替换我。"
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```



## Training data


```
```

## Training procedure

[文言文数据集](https://huggingface.co/datasets/supermy/Classical-Modern) 训练数据. Helsinki-NLP [Helsinki-NLP](Helsinki-NLP/opus-mt-zh-en) 模型:


```

###  entry and citation info

```

```