1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
2
3modelcard = "amurienne/gallek-m2m100"
4
5model = AutoModelForSeq2SeqLM.from_pretrained(modelcard)
6tokenizer = AutoTokenizer.from_pretrained(modelcard)
7
8translation_pipeline = pipeline("translation", model=model, tokenizer=tokenizer, src_lang='fr', tgt_lang='br', max_length=512, device="cpu")
9
10french_text = "traduis de français en breton: j'apprends le breton à l'école."
11
12result = translation_pipeline(french_text)
13print(result[0]['translation_text'])