📝

Text AI Pre-trained Model Catalog — 12 Things You Can Do in 3 Lines of Code

From sentiment analysis to code generation — model list and difficulty for HuggingFace one-liners

All you need is pip install transformers and 3 lines.

Common Structure

from transformers import pipeline
pipe = pipeline("task", model="model_name")
result = pipe("input text")

Tasks by Difficulty

★☆☆☆☆ Sentiment Analysis:

pipe = pipeline("sentiment-analysis")
pipe("I love this!")  # → POSITIVE 0.9998

★☆☆☆☆ Translation:

pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ja")
pipe("Hello")  # → こんにちは

★★☆☆☆ Summarization, QA, Text Generation, NER, Similarity

★★★☆☆ Zero-shot Classification, Code Generation, Chatbot

Model Catalog

Task Model Size GPU?
Sentiment distilbert-sst-2 260MB No
Translation opus-mt-* 300MB No
Summarization bart-large-cnn 1.6GB No
QA distilbert-squad 260MB No
Text gen gpt2 500MB No
Code gen codegen-350M 700MB Rec
Chat DialoGPT-medium 1.5GB Rec

All CPU-runnable. GPU only needed for 7B+ models.

Key Concepts

1

Sentiment (★☆☆☆☆) — pipeline("sentiment-analysis") for positive/negative in one line

2

Translation (★☆☆☆☆) — Helsinki-NLP/opus-mt-{src}-{tgt} for 200+ language pairs

3

Summary/QA/NER (★★☆☆☆) — text understanding tasks with BART, DistilBERT, etc.

4

Text generation (★★☆☆☆) — experience autoregressive generation on CPU with GPT-2 (500MB)

5

Code gen/chatbot (★★★☆☆) — prompt engineering intro with CodeGen, DialoGPT

Use Cases

AI intro — first AI inference experience with 3-line sentiment analysis Prototyping — combine translation + summarization + NER for news analysis tool Model selection guide — recommended models and size/quality trade-offs per task