course icon indicating copy to clipboard operation
course copied to clipboard

sentiment analysis does not predict as expected

Open scenaristeur opened this issue 2 years ago • 0 comments

on this page https://huggingface.co/learn/nlp-course/fr/chapter2/2?fw=pt

this code

from transformers import pipeline

classifier = pipeline("sentiment-analysis")
classifier(
    [
        "I've been waiting for a HuggingFace course my whole life.",
        # J'ai attendu un cours de HuggingFace toute ma vie.
        "I hate this so much!",  # Je déteste tellement ça !
    ]
)

should give us Positive and Negative

[{'label': 'POSITIVE', 'score': 0.9598047137260437},
 {'label': 'NEGATIVE', 'score': 0.9994558095932007}]

But on the Google Collab https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/fr/chapter2/section2_pt.ipynb, with French phrases we've got NEGATIVE and NEGATIVE

from transformers import pipeline

classifier = pipeline("sentiment-analysis", model="tblard/tf-allocine")
classifier(
    ["J'ai attendu un cours d'HuggingFace toute ma vie.",
     "Je déteste tellement ça !"]
)

image

scenaristeur avatar Oct 18 '23 12:10 scenaristeur