Translation
Transformers
Safetensors
llama
text-generation
multilingual
trillionlabs
preview
text-generation-inference
Instructions to use trillionlabs/Tri-1.8B-Translation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trillionlabs/Tri-1.8B-Translation 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="trillionlabs/Tri-1.8B-Translation")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("trillionlabs/Tri-1.8B-Translation") model = AutoModelForCausalLM.from_pretrained("trillionlabs/Tri-1.8B-Translation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Transformers usage error
#1
by BM-K - opened
제공해 주신 usage 실행 시 번역 작업이 수행되지 않습니다.
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("trillionlabs/Tri-1.8B-Translation")
model = AutoModelForCausalLM.from_pretrained("trillionlabs/Tri-1.8B-Translation", device_map="auto")
prompt = "Translate the following Korean text into English:\n안녕하세요 <en>"
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=128)
print(tok.decode(out[0], skip_special_tokens=True))
>>> OUTPUT
Translate the following Korean text into English:
안녕하세요 <en>Hello, I am writing to you to inform you of a new development.
....
We are pleased to announce that we are now able to offer you the service of the most popular and most popular product in the market.
확인해주셔서 감사합니다. README 예시가 chat template 적용이 안되어 있어 생긴 문제였던 것으로 보입니다. 해당 부분 수정했습니다.
정상 작동 확인하였습니다. 빠른 대응에 감사드립니다.
BM-K changed discussion status to closed