WelfCrozzo/kupalinka
Viewer • Updated • 5M • 30 • 3
How to use WelfCrozzo/T5-L128-belarusian 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="WelfCrozzo/T5-L128-belarusian") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("WelfCrozzo/T5-L128-belarusian")
model = AutoModelForSeq2SeqLM.from_pretrained("WelfCrozzo/T5-L128-belarusian")This model is based on T5-small with sequence length equal 128 tokens. Model trained from scratch on RTX 3090 24GB.
<extra_id_1><extra_id_2><extra_id_3><extra_id_5><extra_id_6><extra_id_7>from transformers import T5TokenizerFast, T5ForConditionalGeneration
tokenizer = T5TokenizerFast.from_pretrained("WelfCrozzo/T5-L128-belarusian")
model = T5ForConditionalGeneration.from_pretrained("WelfCrozzo/T5-L128-belarusian")
x = tokenizer.encode('<extra_id_1>да зорак праз цяжкасці', return_tensors='pt')
result = model.generate(x, return_dict_in_generate=True, output_scores=True,max_length=128)
print(tokenizer.decode(result["sequences"][0]))