Hugging Face ecosystem | HF NLP course | 1. Transformer models | Priority Flashcards

1
Q

Code for using an example sentiment analysis pipeline.

hugging-face sentiment-analysis pipeline

A
from transformers import pipeline
							
classifier = pipeline("sentiment-analysis")
classifier("I've been waiting for a HuggingFace course my whole life.")

hugging-face sentiment-analysis pipeline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the output format of a sentiment analysis pipeline for two inputs?

hugging-face sentiment-analysis pipeline

A

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

hugging-face sentiment-analysis pipeline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Code for using an example named entity recognition model.

A
from transformers import pipeline
ner = pipeline("ner", grouped_entities=True)
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
How well did you know this?
1
Not at all
2
3
4
5
Perfectly