openbmb/minicpm/minicpm5-finetune-ms-swift
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 ms-swift or Megatron-SWIFT. Use when the user mentions "ms-swift", "swift sft", "swift rlhf", or "megatron sft". MiniCPM5-1B uses the PyPI release with `--template minicpm5`; MiniCPM5-2B requires `ms-swift>=4.6.0.dev0` with `--template minicpm5_2b`. Both use `--model_type llama`.
Install
npx vskill@latest install openbmb/minicpm/minicpm5-finetune-ms-swiftSKILL.md
The same SKILL.md was published earlier as openbmb/minicpm/minicpm5-finetune-ms-swift.
Fine-tune MiniCPM5-1B and MiniCPM5-2B with ms-swift
Select the version and template that match the model:
| Model | ms-swift version | Arguments | |
|---|---|---|---|
| MiniCPM5-1B | PyPI 4.5.3 | --model_type llama --template minicpm5 | |
| MiniCPM5-2B | >=4.6.0.dev0 | --model_type llama --template minicpm5_2b |
Both models require transformers>=5.6.
ms-swift 4.x renamed `--train_type` to `--tuner_type`. Use--tuner_type lorafor LoRA training.
Required input
| Var | Example | Default | |
|---|---|---|---|
BASE_MODEL | openbmb/MiniCPM5-2B | required; openbmb/MiniCPM5-1B is also supported | |
TEMPLATE | minicpm5_2b | use minicpm5 for MiniCPM5-1B | |
DATA | path to messages-format jsonl | required | |
OUTPUT_DIR | ./runs/minicpm5_swift | required | |
GPU_ID | 0 | 0 |
Each line of DATA: {"messages": [{"role":"...","content":"..."}, ...]}.
Steps
1. Install (once)
For MiniCPM5-1B:
For MiniCPM5-2B:
For Megatron-SWIFT:
2. Train (LoRA SFT)
Set TEMPLATE=minicpm5 for MiniCPM5-1B or TEMPLATE=minicpm5_2b for MiniCPM5-2B.
3. Validate
Loss should decrease over the first few hundred steps:
Adapter is at ${OUTPUT_DIR}/v0-${TIMESTAMP}/checkpoint-${STEP}/.
Merge for serving
The merged model is a regular LlamaForCausalLM and serves with any minicpm5-deploy-* skill.
Full SFT / DPO / RLHF
Same flag surface, just swap the trainer:
Set TEMPLATE=minicpm5 for MiniCPM5-1B or TEMPLATE=minicpm5_2b for MiniCPM5-2B.
For complete training options and configuration details, see the ms-swift command-line parameters and the Megatron-SWIFT quick start.
Multi-GPU
Common pitfalls
- `Failed to automatically match model_type`: add
--model_type llama. - `Failed to automatically match template_type`: use
--template minicpm5for MiniCPM5-1B or--template minicpm5_2bfor MiniCPM5-2B. - `minicpm5_2b is not registered`: the active Python environment is using an older ms-swift release. Install
ms-swift>=4.6.0.dev0; the source installation above pins a known revision for reproducibility. - Conflict with LLaMA-Factory in same env: LLaMA-Factory pins
transformers==4.52, ms-swift wants the latest (currently transformers ≥5.6). Use separate venvs, or setPYTHONNOUSERSITE=1to ignore user-sitetransformers.
Reference
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/minicpm5-finetune-ms-swift/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-ms-swift)