Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: zh
|
| 3 |
+
datasets: c2m
|
| 4 |
+
widget:
|
| 5 |
+
- text: "往者不可谏,来者犹可追。"
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Chinese word-based RoBERTa Miniatures
|
| 12 |
+
|
| 13 |
+
## Model description
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## How to use
|
| 17 |
+
使用 pipeline 调用模型:
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
>>> from transformers import pipeline
|
| 21 |
+
>>> model_checkpoint = "supermy/c2m"
|
| 22 |
+
>>> translator = pipeline("translation",
|
| 23 |
+
model=model_checkpoint,
|
| 24 |
+
num_return_sequences=1,
|
| 25 |
+
max_length=52,
|
| 26 |
+
truncation=True,)
|
| 27 |
+
|
| 28 |
+
>>> translator("往者不可谏,来者犹可追。")
|
| 29 |
+
[{'translation_text': '过 去 的 事 情 不能 劝 谏 , 未来 的 事 情 还 可以 追 回 来 。 如 果 过 去 的 事 情 不能 劝 谏 , 那 么 , 未来 的 事 情 还 可以 追 回 来 。 如 果 过 去 的 事 情'}]
|
| 30 |
+
|
| 31 |
+
>>> translator("福兮祸所伏,祸兮福所倚。",do_sample=True)
|
| 32 |
+
[{'translation_text': '幸 福 是 祸 患 所 隐 藏 的 , 灾 祸 是 福 祸 所 依 托 的 。 这 些 都 是 幸 福 所 依 托 的 。 这 些 都 是 幸 福 所 带 来 的 。 幸 福 啊 , 也 是 幸 福'}]
|
| 33 |
+
|
| 34 |
+
>>> translator("成事不说,遂事不谏,既往不咎。", num_return_sequences=1,do_sample=True)
|
| 35 |
+
[{'translation_text': '事 情 不 高 兴 , 事 情 不 劝 谏 , 过 去 的 事 就 不 会 责 怪 。 事 情 没 有 多 久 了 , 事 情 没 有 多 久 , 事 情 没 有 多 久 了 , 事 情 没 有 多'}]
|
| 36 |
+
|
| 37 |
+
>>> translator("逝者如斯夫!不舍昼夜。",num_return_sequences=1,max_length=30)
|
| 38 |
+
[{'translation_text': '逝 去 的 人 就 像 这 样 啊 , 不分 昼夜 地 去 追 赶 它 们 。 这 样 的 人 就 不 会 忘 记'}]
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 45 |
+
tokenizer = AutoTokenizer.from_pretrained("supermy/c2m")
|
| 46 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("supermy/c2m")
|
| 47 |
+
text = "用你喜欢的任何文本替换我。"
|
| 48 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
| 49 |
+
output = model(**encoded_input)
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## Training data
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Training procedure
|
| 61 |
+
|
| 62 |
+
[文言文数据集](https://huggingface.co/datasets/supermy/Classical-Modern) 训练数据. Helsinki-NLP [Helsinki-NLP](Helsinki-NLP/opus-mt-zh-en) 模型:
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### entry and citation info
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
```
|