randeng-bart-modern-to-classical-100k-bs16
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 加载。项目中主要用于现代汉语到文言风格的转换。
Model Details
- Base model:
IDEA-CCNL/Randeng-BART-139M-SUMMARY - Architecture:
BartForConditionalGeneration - Task: text-to-text generation / modern Chinese to Classical Chinese-style rewriting
- Language: Chinese
- Generation defaults: beam search with
num_beams=4
Intended Use
This 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.
Usage
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
Prompt Format
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.
Limitations
- The model may produce archaic-style text that is grammatically or historically imperfect.
- Long inputs may be truncated depending on generation settings.
- The model card does not include benchmark results yet.
- Outputs should be reviewed before use in formal writing or research.
Files
model.safetensors: fine-tuned BART model weightsconfig.json: model configurationgeneration_config.json: generation defaults- tokenizer files required by
transformers
Framework Versions
- Transformers 4.57.6