File size: 1,208 Bytes
6ef6080 c4f75f9 6ef6080 cc30d18 6ef6080 cc30d18 6ef6080 bfc254e 6ef6080 bfc254e 6ef6080 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
---
language_details: "spa_Latn, quy_Latn, nso_Latn, fra_Latn, bos_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 Mapuzungún.
We support the following languages/graphemaries:
- Spanish (**spa_Latn**)
- Azümchefe (**quy_Latn**)
- Ragileo (**nso_Latn**)
- Unificado (**fra_Latn**)
# Example
```python
from transformers import NllbTokenizerFast, AutoModelForSeq2SeqLM
tokenizer = NllbTokenizerFast.from_pretrained("CenIA/nllb-200-3.3B-spa-arn")
model = AutoModelForSeq2SeqLM.from_pretrained("CenIA/nllb-200-3.3B-spa-arn")
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.convert_tokens_to_ids(translate_to))
decoded = tokenizer.batch_decode(result, skip_special_tokens=True)[0]
return decoded
traduction = translate("Hola, ¿cómo estás?")
print(traduction)
``` |