This model utilises T5-base pre-trained model. It was fine tuned using a modified version of the
JFLEG dataset and
Happy Transformer framework. This model was fine-tuned for sentence correction on normal English translations and positional English translations of local Caribbean English Creole. This model will be updated periodically as more data is compiled. For more on the Caribbean English Creole checkout the library
Caribe.
1
2from happytransformer import HappyTextToText, TTSettings
3
4pre_trained_model="T5"
5model = HappyTextToText(pre_trained_model, "KES/T5-KES")
6
7arguments = TTSettings(num_beams=4, min_length=1)
8sentence = "Wat iz your nam"
9
10correction = model.generate_text("grammar: "+sentence, args=arguments)
11if(correction.text.find(" .")):
12 correction.text=correction.text.replace(" .", ".")
13
14print(correction.text) # Correction: "What is your name?".
15
1
2from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
4tokenizer = AutoTokenizer.from_pretrained("KES/T5-KES")
5
6model = AutoModelForSeq2SeqLM.from_pretrained("KES/T5-KES")
7
8text = "I am lived with my parenmts "
9inputs = tokenizer("grammar:"+text, truncation=True, return_tensors='pt')
10
11output = model.generate(inputs['input_ids'], num_beams=4, max_length=512, early_stopping=True)
12correction=tokenizer.batch_decode(output, skip_special_tokens=True)
13print("".join(correction)) #Correction: I am living with my parents.
14