Unable to load a trained model

Hi,
I’m unable to load a Bert classifier model that is trained on a custom dataset. But using pipeline I’m unable to load the model.

model = pipeline("text-classification", model="path-to-trained-model")

Error:

ValueError: Could not load model [model] with any of the following classes: (<class ‘transformers.models.auto.modeling_auto.AutoModelForSequenceClassification’>, <class ‘transformers.models.bert.modeling_bert.BertForSequenceClassification’>).