Quiz 2
Registry Synced

NLP with Hugging Face

64 words
1 min read

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.