|
--- |
|
license: apache-2.0 |
|
language: |
|
- zh |
|
metrics: |
|
- bleu |
|
pipeline_tag: translation |
|
widget: |
|
- text: "安世字子孺,少以父任为郎" |
|
example_title: "translation" |
|
--- |
|
# Model Description |
|
Erya4FT is based on [Erya](https://huggingface.co/RUCAIBox/Erya) and further fine-tuned on our [Dataset](https://huggingface.co/datasets/RUCAIBox/Erya-dataset), enhancing the ability to translate ancient Chinese into Modern Chinese. |
|
|
|
|
|
# Example |
|
|
|
```python |
|
from transformers import BertTokenizer, CPTForConditionalGeneration |
|
|
|
tokenizer = BertTokenizer.from_pretrained("RUCAIBox/Erya4FT") |
|
model = CPTForConditionalGeneration.from_pretrained("RUCAIBox/Erya4FT") |
|
|
|
input_ids = tokenizer("安世字子孺,少以父任为郎。", return_tensors='pt') |
|
input_ids.pop("token_type_ids") |
|
|
|
pred_ids = model.generate(max_new_tokens=256, **input_ids) |
|
print(tokenizer.batch_decode(pred_ids, skip_special_tokens=True)) |
|
``` |