Instructions to use tencent/Hy-MT2-1.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy-MT2-1.8B with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="tencent/Hy-MT2-1.8B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hy-MT2-1.8B") model = AutoModelForCausalLM.from_pretrained("tencent/Hy-MT2-1.8B", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Unknown Language -> Known Language?
Is there any guidelines or prompt for translating from any supported language to English? It would be good for in the wild translation use cases where the source language may be unknown
You can refer to the prompt in the README — we don't need to specify the source language.
Thank you for the response, and massive thanks to the team for releasing these MT models!
I've been following along with the previous versions as well and each version is a big improvement, and this MT2 can compete with models 3-4x larger in my experience which is crazy
It's also the only model I found that has built in term and style specifications which is very useful for translating large text such as novels (extract terms and specify the style of the novel for example).
I also use it recently on the web to locally translate foreign websites too.
Have a great day! 🤗