AttributeError: 'Flaubert For Sequence Classification' object has no attribute 'predict'
I am trying to classify new dataset from best model after loading but I get this error:best_model_from_training_testing = './checkpoint-900'
best_model= FlaubertForSequenceClassification.from_pretrained(best_model_from_training_testing, num_labels=3)

raw_pred, _, _ = best_model.predict(test_tokenized_dataset)         
predictedLabelOnCompanyData = np.argmax(raw_pred, axis=1)Traceback (most recent call last):
  File "/16uw/test/MODULE_FMC/scriptTraitements/classifying.py", line 408, in <module>
    pred = predict(emb, test_model)
  File "/16uw/test/MODULE_FMC/scriptTraitements/classifying.py", line 279, in predict
    raw_pred, _, _ = model.predict(emb_feature)
  File "/l16uw/.conda/envs/bert/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'FlaubertForSequenceClassification' object has no attribute 'predict'
2021-12-20T13:51:53Z
This model has nopredictmethod indeed. Were you trying to useTrainer.predict?
2021-12-20T14:10:36Z
Yes.Thank you, Actually I finetuned a model via training with the trainer and evaluate on a test data. Now I wanted to load my model and use it on realdata world and as I said the model output the same class for my realdata. I was wondering if I wrote the code correctly. The preprocessing/training/evaluating/testing and saving best model work but when I tried to load the model for inference on new data. The model output same class for every sentence in my dataset even when I tried with the test_dataset I used to evaluate on. Could you help me, the model is supposed to be used by an app for professionnal usage.best_model_from_training_testing = './checkpoint-900'
best_model= FlaubertForSequenceClassification.from_pretrained(best_model_from_training_testing, num_labels=3)
trainer = Trainer(best_model)
raw_pred, _, _ = trainer.predict(test_tokenized_dataset)         
predictedLabelOnCompanyData = np.argmax(raw_pred, axis=1)

run 1 : 1111111111111111111111111111
run2: 1111111111111111111111112222
run3: 333333333333333333333333As you see the output keep changing  and is not fixed , I do not know How to solve it. Any idea could be helpful. Should I still use trainer for inference ?