0

I just wanted to test the facebook/bart-largemnli model but it doesn’t work and I don’t know how to fix it.

The code:

from transformers import pipeline
classifier = pipeline(“zero-shot-classification”, model=“facebook/bart-large-mnli”)

The error message:

ValueError : Could not load model facebook/bart-large-mnli with any of the following classes: (<class ‘transformers.models.auto.modeling_tf_auto.TFAutoModelForSequenceClassification’>,)

classifier = pipeline(task="sentiment-analysis", model="roberta-large-mnli") Works for example.

What can I do? I already cleaned the disk space.

Thank you a lot!

Shaida Muhammad
  • 1,428
  • 14
  • 25
qwerty
  • 1
  • 1
  • 1
  • Does this answer your question? [Transformers model from Hugging-Face throws error that specific classes couldn t be loaded](https://stackoverflow.com/questions/70622895/transformers-model-from-hugging-face-throws-error-that-specific-classes-couldn-t) – Shaida Muhammad Feb 24 '22 at 10:13

2 Answers2

4

facebook/bart-large-mnli doesn't offer a TensorFlow model at the moment. To load the PyTorch model into the pipeline, make sure you have PyTorch installed:

pip install torch

...and then re-run your code.

jamix
  • 5,484
  • 5
  • 26
  • 35
0

On Hugging Face, not all the models are supported by TensorFlow. This model and (apparently) all other Zero Shot Pipeline models are supported only by PyTorch.

On the Hugging Face model selection page you can toggle options under Libraries to limit the model selection to the libraries you are using.