Practical Examples
Three examples, shallow to deep: an off-the-shelf sentiment pipeline, a retrieval-free chatbot, and a Trainer / LoRA outline. All models are ungated.
Example 1: Sentiment pipeline
Goal: Label short English reviews—enough for a moderation prototype.
Check: try obviously positive and negative sentences; confirm POSITIVE / NEGATIVE and the scores. For Chinese reviews, pick a Chinese checkpoint or fine-tune a Chinese DistilBERT—this SST-2 model is English.
Example 2: RAG-less chatbot (generate)
Goal: Multi-turn chat with no vector store. Use Qwen if you have a GPU; on CPU you can swap model_id to distilbert/distilgpt2 and drop the chat template (plain continuation).
This is RAG-less: knowledge lives only in the weights and will hallucinate. For documents, see LangChain or your own retriever. For stable local chat, Ollama is less work.
Example 3: Fine-tune outline (Trainer or LoRA)
Path A — classification (shrink the data on CPU): follow Fine-tuning on distilbert/distilbert-base-uncased + rotten_tomatoes, call trainer.train(), then pipeline("text-classification", model=save_dir).
Path B — causal LM + LoRA (GPU recommended):
pip install peft- Prepare
{"messages": [...]}or plain text;maptoinput_ids/labels LoraConfig(task_type=TaskType.CAUSAL_LM, r=8, target_modules=["q_proj", "v_proj"])get_peft_model, thenTrainerwithper_device_train_batch_size=1and gradient accumulation if neededpush_to_hubonly the adapter; the card must nameQwen/Qwen2.5-0.5B-Instructas the base
VRAM: even 0.5B full FT can be tight; 7B full FT needs serious GPUs. On OOM, drop the batch or enable LoRA—do not blindly switch to Llama.