openbmb/minicpm/minicpm5-finetune-trl
Claude Code and agent skill by openbmb/minicpm
- community
Checking that the SKILL.md file is still in the repository.
Fine-tune MiniCPM5-1B or MiniCPM5-2B with bare-metal TRL + PEFT, including assistant-only loss via a chat-template patch. Use when the user wants minimal Python, no YAML, full control, or asks for "TRL", "SFTTrainer", "PEFT", "LoraConfig", "assistant_only_loss".
Install
npx vskill@latest install openbmb/minicpm/minicpm5-finetune-trlSKILL.md
The same SKILL.md was published earlier as openbmb/minicpm/minicpm5-finetune-trl.
Fine-tune MiniCPM5-1B and MiniCPM5-2B with TRL + PEFT
Bare-metal Python recipe with assistant-only loss mask. Minimal abstractions, full control.
Required input
| Var | Example | Default | |
|---|---|---|---|
BASE_MODEL | openbmb/MiniCPM5-2B | required; openbmb/MiniCPM5-1B also works | |
DATA | path to messages-format jsonl | required | |
OUTPUT_DIR | ./runs/minicpm5_trl | required |
Steps
1. Install (once)
2. Patch the tokenizer with a training-only chat template
Save as train_lora.py:
3. Train
4. Validate
You should see:
Adapter saved to ${OUTPUT_DIR}/adapter_final/adapter_model.safetensors.
Inference with the LoRA
🔑 Always reload the original tokenizer at inference time — the patched chat template is for training only. The LoRA adapter is fully compatible with the original chat template (token sequence is identical).
Merge for serving
Common pitfalls
- `SFTConfig has no attribute 'max_length'`: your
trlis too old. Needtrl>=0.21. - Loss does not decrease:
assistant_only_loss=Truerequires the{% generation %}block in the chat template. If you forgot to set the patched template, TRL falls back to loss-over-all-tokens.
Reference
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/minicpm5-finetune-trl/SKILL.md
Popularity
- Repository stars
- 9,518
- Repository forks
- 625
- 7-day trend score
- 46
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/openbmb/minicpm/minicpm5-finetune-trl)