gsarti/iwslt2017_context
Viewer • Updated • 5.55M • 1.2k • 1
How to use context-mt/scat-mbart50-1toM-target-ctx4-cwd0-en-fr 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="context-mt/scat-mbart50-1toM-target-ctx4-cwd0-en-fr") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("context-mt/scat-mbart50-1toM-target-ctx4-cwd0-en-fr")
model = AutoModelForSeq2SeqLM.from_pretrained("context-mt/scat-mbart50-1toM-target-ctx4-cwd0-en-fr")*This model corresponds to the mBART 1-to-50 model further trained on English-to-French translation on the IWSLT17 dataset with context tags using the format:
Input: SOURCE_CTX <brk> SOURCE_CURR
Output: TARGET_CTX <brk> TARGET_CURR
and further fine-tuned on the training split of SCAT+. The model was used in the evaluation of the paper Quantifying the Plausibility of Context Reliance in Neural Machine Translation published at ICLR 2024, also available on Arxiv. It can be used for English to French contextual and non-contextual translation.