Downloads · 30 days
6
8% of all-time downloads
liuyanliang/randeng-bart-modern-to-classical-100k-bs16
randeng-bart-modern-to-classical-100k-bs16 is a translation model from liuyanliang. Use it when you need text moved from one language to another. It is set up for transformers.
This repository contains a fine-tuned BART sequence-to-sequence model for Chinese text rewriting in the Classical Chinese NLP project. The exported checkpoint is based on IDEA-CCNL/Randeng-BART-139M-SUMMARY and is use…
Downloads · 30 days
6
8% of all-time downloads
All-time downloads
80
Public
Parameters
139M
559 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors558 MB · 100%
From the Hugging Face model README
This repository contains a fine-tuned BART sequence-to-sequence model for Chinese text rewriting in the Classical Chinese NLP project.
The exported checkpoint is based on IDEA-CCNL/Randeng-BART-139M-SUMMARY and is used by the project backend for text-to-text generation.
本仓库包含完整的 BartForConditionalGeneration 权重,可直接通过 transformers 加载。项目中主要用于现代汉语到文言风格的转换。
IDEA-CCNL/Randeng-BART-139M-SUMMARYBartForConditionalGenerationnum_beams=4This model is intended for the Classical Chinese NLP demo backend and CLI. It is suitable for experimental text rewriting and educational demos.
The model should not be treated as a verified Classical Chinese translator for scholarly or legal use.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_id = "liuyanliang/randeng-bart-modern-to-classical-100k-bs16"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
model.eval()
text = "今文翻古:学习后按时温习,不也很快乐吗"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
outputs = model.generate(**inputs, max_new_tokens=128, num_beams=4)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
For this project backend:
export CCNLP_SEQ2SEQ_MODEL=liuyanliang/randeng-bart-modern-to-classical-100k-bs16
PYTHONPATH=src uvicorn ccnlp.api_server:app --host 127.0.0.1 --port 8000
The project uses task prefixes before the input text:
今文翻古:<modern Chinese input>
古文翻今:<Classical Chinese input>
For best results, use the same prefixes as the project code.
model.safetensors: fine-tuned BART model weightsconfig.json: model configurationgeneration_config.json: generation defaultstransformers