Machine Learning
Beginner
4.5
Sentiment Analysis with Hugging Face
Run a state-of-the-art NLP model in three lines with pipelines.
0h 25m
1 lesson
1.2K students
What You'll Learn
Learning objectives will be added soon.
Tutorial Content
The pipeline shortcut
Hugging Face pipeline hides all the complexity of tokenization and model loading.
from transformers import pipeline
classifier = pipeline("sentiment-analysis")
print(classifier("I absolutely loved this tutorial!"))
# [{'label': 'POSITIVE', 'score': 0.9998}]Beyond the default
Swap in any model from the Hub for your task or language:
pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")The same pipeline interface works for translation, summarization, NER, and more — a great way to start before you fine-tune your own.
Your Progress
Sign in to track your progress
Tags
NLP
Hugging Face
Transformers
Python