Instructions to use RUCAIBox/Erya4FT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RUCAIBox/Erya4FT with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="RUCAIBox/Erya4FT")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("RUCAIBox/Erya4FT") model = AutoModelForSeq2SeqLM.from_pretrained("RUCAIBox/Erya4FT") - Notebooks
- Google Colab
- Kaggle
Model Description
Erya4FT is based on Erya and further fine-tuned on our Dataset, enhancing the ability to translate ancient Chinese into Modern Chinese.
Example
>>> 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))
['这 小 子 不 值 得 与 他 商 量 。']
- Downloads last month
- 4