jhu-clsp/jfleg
Viewer • Updated • 1.5k • 2.25k • 77
Run KES/T5-KES on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/KES/T5-KES. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/KES/T5-KES on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use KES/T5-KES with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("KES/T5-KES")
model = AutoModelForSeq2SeqLM.from_pretrained("KES/T5-KES", device_map="auto")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.
The results of fine-tuning resulted in a final accuracy of 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?".
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.
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("KES/T5-KES") model = AutoModelForSeq2SeqLM.from_pretrained("KES/T5-KES", device_map="auto")