Downloads · 30 days
16
4% of all-time downloads
onlysainaa/cyrillic_to_script-t5-model
cyrillic_to_script-t5-model is a machine learning model from onlysainaa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads · 30 days
16
4% of all-time downloads
All-time downloads
371
Public
Parameters
60.5M
242 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors242 MB · 99%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
#Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("onlysainaa/cyrillic_to_script-t5-model")
model = AutoModelForSeq2SeqLM.from_pretrained("onlysainaa/cyrillic_to_script-t5-model")
#Check if CUDA (GPU) is available
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
#Move the model to the same device (GPU or CPU)
model.to(device)
#Prepare text input
input_text = "сайн уу" #Mongolian greeting
#Tokenize the input text
inputs = tokenizer(input_text, return_tensors="pt")
#Move the input tensors to the same device as the model
inputs = {k: v.to(device) for k, v in inputs.items() if k in ['input_ids', 'attention_mask']}
#Generate translation
outputs = model.generate(**inputs)
#Decode the output to human-readable text
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
#Print the translated text
print(f"Translated Text: {translated_text}")