agentlans/high-quality-english-sentences
Viewer • Updated • 1.71M • 1.26k • 34
How to use Cipher-AI/AutoCorrect-EN with Transformers:
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("Cipher-AI/AutoCorrect-EN")
model = AutoModelForSeq2SeqLM.from_pretrained("Cipher-AI/AutoCorrect-EN")This model is for typos in texts and it outputs corrected texts.
Example:
Text with Typos: Whathvhr wh call owr carhaivhrs - doctors, nwrsh practitionhrs, clinicians, - wh nhhd thhm not only to carh, wh nhhd thhm to uh aulh to providh thh riaht valwh.
Corrected Text: Whatever we call our caregivers - doctors, nurse practitioners, clinicians, - we need them not only to care, we need them to be able to provide the right value.
Example Usage:
#Load the model and tokenizer
text = "" #Text with typos here!
inputs = tokenizer(cipher_text, return_tensors="pt", padding=True, truncation=True, max_length=256).to(device)
outputs = model.generate(inputs["input_ids"], max_length=256)
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Cipher-AI/AutoCorrect-EN") model = AutoModelForSeq2SeqLM.from_pretrained("Cipher-AI/AutoCorrect-EN")