|
--- |
|
dataset_info: |
|
features: |
|
- name: info |
|
dtype: string |
|
- name: modern |
|
dtype: string |
|
- name: classical |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 209412286 |
|
num_examples: 972467 |
|
download_size: 123454543 |
|
dataset_size: 209412286 |
|
license: apache-2.0 |
|
task_categories: |
|
- translation |
|
language: |
|
- zh |
|
size_categories: |
|
- 100K<n<1M |
|
--- |
|
# Dataset Card for "Chinese_modern_classical" |
|
|
|
数据来自于[NiuTrans/Classical-Modern: 非常全的文言文(古文)-现代文平行语料 (github.com)](https://github.com/NiuTrans/Classical-Modern)。 |
|
|
|
由于原始数据中部分古文没有译文,所以本数据集的数据仅包括了[双语数据 ](https://github.com/NiuTrans/Classical-Modern/tree/main/双语数据)。 |
|
|
|
# Usage |
|
```python |
|
from transformers import AutoModelForSeq2SeqLM |
|
from transformers import AutoTokenizer |
|
|
|
prefix = "普通话到文言文" |
|
tokenizer = AutoTokenizer.from_pretrained("xmj2002/bart_modern_classical") |
|
model = AutoModelForSeq2SeqLM.from_pretrained("xmj2002/bart_modern_classical") |
|
|
|
text = "曲曲折折的荷塘上面,弥望旳是田田的叶子。叶子出水很高,像亭亭旳舞女旳裙。" |
|
inputs = tokenizer(prefix+text, return_tensors="pt").input_ids |
|
outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95) |
|
tokenizer.decode(outputs[0], skip_special_tokens=True) |
|
|
|
# output:曲 塘 之 上 , 弥 望 则 田 田 之 叶 , 叶 出 水 高 , 若 舞 女 低 裙 。 |
|
``` |