Predict the output of a text - Sentiment Analysis
Hi everyone,I fine tuned distilbert sequence classification class on an English corpus with about 40,000 texts.the model resulted the accuracy of 88 percent, but I can’t get true predicts for a text as an input.Please help me, what should I do to fix this conflict.this is the function I use to predict the output:def predict_text(model,text):inputs = tokenizer(text, return_tensors=“pt”)inputs = {k:v.to(device) for k,v in inputs.items()}with torch.no_grad():outputs = model(**inputs)y_out = np.argmax(outputs.logits.cpu(),axis=1)return outputsthis is the way I call the function and it gives me positive class for this sentence:predict_text(trainer.model,“Let’s try something else. It doesn’t work properly.”)
2022-06-27T19:30:17Z
Your predict function is fine. The prediction returns a wrong result probably because the trained model can’t find a good fit for it. (Since you’ve already said that the accuracy is 0.88)
2022-07-02T10:55:07Z
Thank you for your answer. What can I do to predict the right label in the output?