Downloads · 30 days
10
2% of all-time downloads
TurkLangsTeamURFU/pst5-tg-fa-bidirectional
pst5-tg-fa-bidirectional is a machine learning model from TurkLangsTeamURFU. 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.
Developed as a semester project in URFU ordered by NAUMEN
Downloads · 30 days
10
2% of all-time downloads
All-time downloads
612
Public
Repo size
2 GB
Likes
0
Public
Click a slice to open those files.
.bin977 MB · 100%
From the Hugging Face model README
Developed as a semester project in URFU ordered by NAUMEN
authors:
!pip install transformers sentencepiece --quiet
import torch
from transformers import T5ForConditionalGeneration, T5Tokenizer
model_name = "sml-msn/pst5-tg-fa-bidirectional"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
def translit(x, **kwargs):
inputs = tokenizer(x, return_tensors='pt').to(model.device)
with torch.no_grad():
hypotheses = model.generate(**inputs, **kwargs)
return tokenizer.decode(hypotheses[0], skip_special_tokens=True)
print(translit('Салом Ҷаҳон', max_length = 1024))
print('-------------------')
print(translit('سلام جهان', max_length = 1024))