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 outputs
this 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.”)