Instructions to use deep-learning-analytics/GrammarCorrector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deep-learning-analytics/GrammarCorrector with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("deep-learning-analytics/GrammarCorrector") model = AutoModelForSeq2SeqLM.from_pretrained("deep-learning-analytics/GrammarCorrector") - Notebooks
- Google Colab
- Kaggle
This model doesn't work for long sentences.
#3
by Akshaykdubey - opened
How to make this model work for long sentences(basically paragraphs)? I believe we can increase the size of max_length parameter below but it also works till a limit.
def correct_grammar(input_text,num_return_sequences):
batch = tokenizer([input_text],truncation=True,padding='max_length',max_length=64, return_tensors="pt").to(torch_device)
translated = model.generate(**batch,max_length=64,num_beams=num_beams, num_return_sequences=num_return_sequences, temperature=1.5)
tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)
return tgt_text
Any suggestions?