Can You fix for swahili translation
from transformers import MBartForConditionalGeneration, MBart50Tokenizer
English to swahili
article_en = "Tell me about urine collection"
Arabic to English
article_ar = "ุงูุฃู ูู ุงูุนุงู ููุฃู ู ุงูู ุชุญุฏุฉ ูููู ุฅูู ูุง ููุฌุฏ ุญู ุนุณูุฑู ูู ุณูุฑูุง."
Load pre-trained model and tokenizer
model = MBartForConditionalGeneration.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
tokenizer = MBart50Tokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
Translate English to swahili
tokenizer.src_lang = "en_XX"
encoded_sw = tokenizer(article_en, return_tensors="pt")
generated_tokens_sw = model.generate(
**encoded_sw,
forced_bos_token_id=tokenizer.lang_code_to_id["sw_KE"]
)
output_hi = tokenizer.batch_decode(generated_tokens_sw, skip_special_tokens=True)
Print English to swahili Translation
print("English to swahili Translation:")
print(output_hi[0])
English to swahili Translation:
me: Tell me about urine collection
Arabic to English Translation:
The Secretary-General of the United Nations says there is no military solution in Syria.