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
Sentiment (โ โโโโ) โ pipeline("sentiment-analysis") for positive/negative in one line
Translation (โ โโโโ) โ Helsinki-NLP/opus-mt-{src}-{tgt} for 200+ language pairs
Summary/QA/NER (โ โ โโโ) โ text understanding tasks with BART, DistilBERT, etc.
Text generation (โ โ โโโ) โ experience autoregressive generation on CPU with GPT-2 (500MB)
Code gen/chatbot (โ โ โ โโ) โ prompt engineering intro with CodeGen, DialoGPT