Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
# Model Description
|
5 |
+
Erya4FT is based on Erya and further fine-tuned on our dataset[RUCAIBox/Erya-dataset · Datasets at Hugging Face](https://huggingface.co/datasets/RUCAIBox/Erya-dataset), enhancing the ability to translate ancient Chinese into Modern Chinese.
|
6 |
+
|
7 |
+
|
8 |
+
# Example
|
9 |
+
|
10 |
+
```python
|
11 |
+
from transformers import BertTokenizer, CPTForConditionalGeneration
|
12 |
+
|
13 |
+
tokenizer = BertTokenizer.from_pretrained("RUCAIBox/Erya")
|
14 |
+
model = CPTForConditionalGeneration.from_pretrained("RUCAIBox/Erya4FT")
|
15 |
+
|
16 |
+
input_ids = tokenizer("安世字子孺,少以父任为郎。", return_tensors='pt')
|
17 |
+
input_ids.pop("token_type_ids")
|
18 |
+
|
19 |
+
pred_ids = model.generate(max_new_tokens=256, **input_ids)
|
20 |
+
print(tokenizer.batch_decode(pred_ids, skip_special_tokens=True))
|
21 |
+
```
|