Translation
Transformers
Safetensors
llama
text-generation
multilingual
lora
astheraltranslate
text-generation-inference
Instructions to use SEE7/AstheralTranslate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SEE7/AstheralTranslate 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="SEE7/AstheralTranslate")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SEE7/AstheralTranslate") model = AutoModelForCausalLM.from_pretrained("SEE7/AstheralTranslate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,074 Bytes
2c5fc66 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import requests,os,json,time
base='https://see7-astheraltranslate.hf.space';headers={'Authorization':'Bearer '+os.environ['HF_TOKEN']}
q=requests.get(base+'/api/quota-status',timeout=15);print('QUOTA',q.status_code,q.text,flush=True)
results=[]
for name in ['German','French','Spanish','Italian','Portuguese']:
body={'model':'SEE7/AstheralTranslate','messages':[{'role':'user','content':'[Target: '+name+']\nThe train leaves at eight in the morning.'}],'max_tokens':96,'temperature':0,'stream':False}
start=time.monotonic();r=requests.post(base+'/v1/chat/completions',json=body,headers=headers,timeout=40)
print('LIVE',name,r.status_code,r.text[:1200],flush=True)
if r.status_code!=200:raise RuntimeError(r.text)
d=r.json();text=d['choices'][0]['message']['content'];assert text.strip()
results.append({'target':name,'source':'The train leaves at eight in the morning.','translation':text,'seconds':time.monotonic()-start})
open('/tmp/live_translation_test.json','w').write(json.dumps(results,ensure_ascii=False,indent=2))
print('LIVE_FIVE_LANGUAGES_PASS',flush=True)
|