Quiz 2

NLP with Hugging Face

64 words
1 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# NLP with Hugging Face [Join Discord](https://discord.gg/gE2m4Qrdqv) [Previous**Computer Vision**](/notes/04-degree-electives-bsda4001-ds-ai-lab-week04-04-computer-vision)[Next**Prompt Engineering**](/notes/04-degree-electives-bsda4001-ds-ai-lab-week06-06-prompt-engineering)

NLP with Hugging Face

python
from transformers import pipeline
# Sentiment analysis
classifier = pipeline("sentiment-analysis")
result = classifier("I love this course!")
print(result)
# Text generation
generator = pipeline("text-generation", model="gpt2")
result = generator("The future of AI is", max_length=30)
print(result[0]['generated_text'])
# Text classification with BERT
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = AutoModelForSequenceClassification.from_pretrained(
    "bert-base-uncased", num_labels=2
)
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.