Quick Start
This chapter runs your first inference with Pipeline. The pipeline downloads the tokenizer and weights and caches them. Every example is ungated.
Sentiment classification (start here)
distilbert/distilbert-base-uncased-finetuned-sst-2-english is DistilBERT fine-tuned on SST-2—the usual official classification demo:
Typical output:
What happens:
from_pretrainedfetchesconfig.json, the vocab, andmodel.safetensors- The tokenizer turns text into
input_ids/attention_mask - The model emits logits; the pipeline applies softmax and maps labels
To fine-tune the same architecture yourself, use the base distilbert/distilbert-base-uncased plus rotten_tomatoes—see Fine-tuning.
Text generation (small models)
DistilGPT2 is CPU-friendly for continuation. For instruction chat or Chinese, switch to Qwen:
Instruct model (~0.5B; a GPU is more comfortable):
On the Hub, Qwen and DeepSeek Instruct checkpoints are also CN-friendly—check gated status and VRAM first.
Devices
On NVIDIA GPUs, Pipeline accepts device=0. For automatic placement, use the lower-level API:
If you only want chat and not weight formats, use Ollama. To control decoding, continue with Text Generation.
How long is the first download?
DistilBERT / DistilGPT2 are tens to ~150 MB; Whisper-tiny is about 150 MB; Qwen2.5-0.5B is about 1 GB. After the progress bar finishes, files live under HF_HOME and the next run is nearly instant.
Checklist
- Create a venv; install
torchandtransformers datasets evaluate accelerate - Run the classification pipeline
- Run DistilGPT2 generation and watch
max_new_tokens - (Optional)
hf auth loginso you can upload later - Skim the model card