course icon indicating copy to clipboard operation
course copied to clipboard

Course is not adapted for local config

Open scenaristeur opened this issue 2 years ago • 0 comments

On collab, the result is automatically show, but not in Local config. In local, if a newbie try the code, nothing will happened, and the user will not understand why for example on this course https://huggingface.co/learn/nlp-course/fr/chapter1/3?fw=pt

The user, must manually get the classifier result and print it

Something should be mentionned in this sens and the code adapted like

from transformers import pipeline

classifier = pipeline("sentiment-analysis")
result1 = classifier(
    "I've been waiting for a HuggingFace course my whole life."
)  # J'ai attendu un cours d'HuggingFace toute ma vie.

#[{'label': 'POSITIVE', 'score': 0.9598047137260437}]

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

print("result1", result1)
print("result2", result2)

scenaristeur avatar Oct 16 '23 09:10 scenaristeur