No errors but no output

I’m going through the first steps of the course. The example code works fine on Google Colab but not on my laptop. I installed transformers andits dependencies in an anaconda environment. When I run the following code:

from transformers import pipeline
classifier = pipeline(“sentiment-analysis”)classifier(“I’ve been waiting for a HuggingFace course my whole life.”)

The output is:

(ai) mike@M-MacBook-Pro transformers % python test2.py      
No model was supplied, defaulted to distilbert/distilbert-base-uncased-finetuned-sst-2-english and revision 714eb0f ().
Using a pipeline without specifying a model name and revision in production is not recommended.
Device set to use cpu
(ai) mike@M-MacBook-Pro transformers %

but when I run the same code on Colab, I get a classification. Any ideas on what the problem is?

1 Like

In Colab I got:

from transformers import pipeline
classifier = pipeline("sentiment-analysis")
result = classifier("I’ve been waiting for a HuggingFace course my whole life.")
print(result)
"""
No model was supplied, defaulted to distilbert/distilbert-base-uncased-finetuned-sst-2-english and revision 714eb0f
Device set to use cpu
[{'label': 'POSITIVE', 'score': 0.9621986150741577}]
"""

Any ideas on what the problem is?

So maybe version mismatch of Transformers?

!pip install -U transformers

No joy. I also tried the latest version from github…

1 Like

It seems that in the current pipeline implementation, sentiment-analysis is just an alias for text-classification.