--- language_details: "quy_Latn, spa_Latn" pipeline_tag: translation tags: - nllb license: "cc-by-nc-4.0" inference: false --- # Description Finetuned [facebook/nllb-200-3.3B](https://huggingface.co/facebook/nllb-200-3.3B) model to translate between Spanish ("spa_Latn") and Mapuzungun ("quy_Latn"). # Example ```python from transformers import NllbTokenizer, AutoModelForSeq2SeqLM tokenizer = NllbTokenizer.from_pretrained("CenIA/nllb-200-3.3B-spa-arn", use_auth_token="HF_TOKEN") model = AutoModelForSeq2SeqLM.from_pretrained("CenIA/nllb-200-3.3B-spa-arn", use_auth_token="HF_TOKEN") def translate(sentence: str, translate_from="spa_Latn", translate_to="quy_Latn") -> str: tokenizer.src_lang = translate_from tokenizer.tgt_lang = translate_to inputs = tokenizer(sentence, return_tensors="pt") result = model.generate(**inputs, forced_bos_token_id=tokenizer.lang_code_to_id[translate_to]) decoded = tokenizer.batch_decode(result, skip_special_tokens=True)[0] return decoded traduction = translate("Hola, ¿cómo estás?") print(traduction) ```