模型:

BlackKakapo/t5-small-grammar-ro-root

英文

罗马尼亚语法

该模型是在根词形式的句子上训练的。它可以将单词转化为语法正确的形式。

前缀

语法:文本

如何使用

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")
model = AutoModelForSeq2SeqLM.from_pretrained("BlackKakapo/t5-small-grammar-ro-root")

或者

pip install happytransformer
from happytransformer import TTSettings, HappyTextToText

happy_tt_save = HappyTextToText('T5',r"BlackKakapo/t5-small-grammar-ro")
beam_settings =  TTSettings(num_beams=10, min_length=10, max_length=100)

生成

sent = "As dori ca sa corecteze toate greșelile."
prefix = "grammar: "
example = prefix + sent

result = happy_tt_save.generate_text(example, args=beam_settings)

print(result.text)

输出

Aș dori ca să corecteze toate greșelile.