--- license: cc-by-nc-4.0 language: - en - si pipeline_tag: translation datasets: - zaanind/sinhala_englsih_parrel_corpus - zaanind/sinhala_englsih_nmt inference: parameters: src_lang: "eng_Latn" tgt_lang: "sin_Sinh" widget: - text: "you will receive a notification when your order is ready for pickup" example_title: "example 1" - text: "you will receive a response to your inquiry within 24 hours" example_title: "example 2" - text: "i'm glad i could make it to your birthday event it was such a memorable experience" example_title: "example 3" --- # What Is This? It is a [NLLB-200-600M](https://huggingface.co/facebook/nllb-200-distilled-600M) model fine-tuned for translating between englih and sinhala languages Training & Inference Codes - [https://github.com/zaanind/NLLB-200-Sinhala](https://github.com/zaanind/NLLB-200-Sinhala) # Try It - [Try it at our website](https://zaanind.pythonanywhere.com) # How to use the model: 1.Install necessary libraries ``` pip install requests sentencepiece transformers==4.33 sacremoses sacrebleu ``` 2.Translate! ``` from transformers import AutoModelForSeq2SeqLM, AutoTokenizer import torch model_name = "zaanind/nllb-ensi-v1-tuning" #download model tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSeq2SeqLM.from_pretrained(model_name) def dotranslate(text): #define function for generation inputs = tokenizer(text, return_tensors="pt") translated_tokens = model.generate(**inputs, forced_bos_token_id=tokenizer.lang_code_to_id["sin_Sinh"]) out = tokenizer.decode(translated_tokens[0], skip_special_tokens=True) return out dotranslate("hello how are you?") #translate ``` # Contact - [https://t.me/zaanind](https://t.me/zaanind)