英文

模型

该模型使用了T5-base预训练模型。它使用了修改过的 JFLEG 数据集和 Happy Transformer framework 进行微调。该模型用于纠正普通英语翻译和位置英语翻译的加勒比英语克里奥尔语。随着更多数据的收集,该模型将定期进行更新。关于加勒比英语克里奥尔语的更多信息,请参考 Caribe 图书馆。

重新训练/微调

微调的结果得到了92%的最终准确率。

使用

from happytransformer import HappyTextToText, TTSettings

pre_trained_model="T5"
model = HappyTextToText(pre_trained_model, "KES/T5-KES")

arguments = TTSettings(num_beams=4, min_length=1)
sentence = "Wat iz your nam"

correction = model.generate_text("grammar: "+sentence, args=arguments)
if(correction.text.find(" .")):
    correction.text=correction.text.replace(" .", ".")

print(correction.text) # Correction: "What is your name?".

与Transformers一起使用

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("KES/T5-KES")

model = AutoModelForSeq2SeqLM.from_pretrained("KES/T5-KES")

text = "I am lived with my parenmts "
inputs = tokenizer("grammar:"+text, truncation=True, return_tensors='pt')

output = model.generate(inputs['input_ids'], num_beams=4, max_length=512, early_stopping=True)
correction=tokenizer.batch_decode(output, skip_special_tokens=True)
print("".join(correction)) #Correction: I am living with my parents.