Instructions to use hsilvosa/hsc-wuxia-mbart-large-50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hsilvosa/hsc-wuxia-mbart-large-50 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="hsilvosa/hsc-wuxia-mbart-large-50")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("hsilvosa/hsc-wuxia-mbart-large-50") model = AutoModelForSeq2SeqLM.from_pretrained("hsilvosa/hsc-wuxia-mbart-large-50", device_map="auto") - Notebooks
- Google Colab
- Kaggle
HSC Wuxia mBART-50 Model
This model is a fine-tuned sequence-to-sequence model based on facebook/mbart-large-50-many-to-many-mmt for Chinese-to-English translation of Wuxia and Xianxia literature. It was developed as part of the Bachelor's Thesis (TFG):
"Enfoques de traducción automática con modelos de lenguaje en obras wuxia" (Degree in Data Science and Engineering, Universidade da Coruña)
Model Details
- Base Model: facebook/mbart-large-50-many-to-many-mmt
- Training Method: Full architectural fine-tuning
- Training Dataset: HSilvosa/hsc-wuxia-100k (100,000 stratified parallel sentence pairs)
- Target Domain: Wuxia/Xianxia web novels
Intended Use
This model can be used directly for Chinese-to-English translation of literary text in the Wuxia domain.
Quick Start (Inference)
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
model_name = "HSilvosa/hsc-wuxia-mbart-large-50"
model = MBartForConditionalGeneration.from_pretrained(model_name)
tokenizer = MBart50TokenizerFast.from_pretrained(model_name)
# Set source and target language
tokenizer.src_lang = "zh_CN"
text = "一念成沧海,一念化桑田。"
encoded_zh = tokenizer(text, return_tensors="pt")
generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.lang_code_to_id["en_XX"])
print(tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0])
Evaluation Results
The model was evaluated on the Wuxia parallel test set, comparing the base model and the fine-tuned version:
| Metric | Base Model (mbart-large-50-...) |
Fine-tuned Model (hsc-wuxia-mbart-large-50) |
Delta (Improvement) |
|---|---|---|---|
| SacreBLEU | 6.33 | 37.73 | +31.40 |
| chrF | 26.73 | 56.22 | +29.49 |
| ROUGE-L | 29.26 | 62.45 | +33.19 |
| METEOR | 25.79 | 61.91 | +36.12 |
| COMET | 60.86 | 79.96 | +19.10 |
Training Hyperparameters
The model was fine-tuned using the following architectural training parameters:
- Optimizer: AdamW
- Learning Rate: 2e-5 (0.00002)
- Weight Decay: 0.01
- Epochs: Max 10 (with early stopping patience of 3 epochs based on validation loss)
- Batch Size: 16 (per device/GPU)
- Max Sequence Length: 128 tokens
- Seed: 42
Project Repository
This model and the associated training/evaluation pipelines were developed in the following project repository:
- GitHub Repository: HugoSilvosa/hsc-mtl-wuxia
- Downloads last month
- 24
Model tree for hsilvosa/hsc-wuxia-mbart-large-50
Base model
facebook/mbart-large-50-many-to-many-mmt