sumitaryal/nepali_grammatical_error_detection
Viewer • Updated • 10.9M • 8
How to use sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa")
model = AutoModelForSequenceClassification.from_pretrained("sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa")This model is designed for the Nepali Grammatical Error Detection (GED) task. It utilizes the BERT-based NepBERTa model to identify grammatical errors in Nepali text.
Use the code below to get started with the model.
import torch
from transformers import BertForSequenceClassification, AutoTokenizer
model = BertForSequenceClassification.from_pretrained("sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa")
tokenizer = AutoTokenizer.from_pretrained("sumitaryal/Nepali_Grammatical_Error_Detection_NepBERTa", do_lower_case=False)
input_sentence = "रामले भात खायो ।"
inputs = tokenizer(input_sentence, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
predicted_class = model.config.id2label[predicted_class_id]
print(f'The sentence "{input_sentence}" is "{predicted_class}"')
Base model
NepBERTa/NepBERTa