minicpm5-finetune-gguf-lora
What it does
This skill guides your AI through making a LoRA adapter for MiniCPM5-1B and converting it into GGUF format. It is for people who run MiniCPM5 as a GGUF model and want a custom version.
When to use it
- โWhen you have a trained LoRA adapter and want to load it into llama-server.
- โWhen you want to convert a LoRA adapter with the convert_lora_to_gguf script.
- โWhen you want to upload a custom persona or skin to the MiniCPM Desk Pet app.
Skill link
https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-finetune-gguf-lora/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentโs skills folder.
Example of what to ask your AI
โTurn my trained LoRA adapter for MiniCPM5-1B into a GGUF file that llama-server can load.โ
5 new skills a week. 1 minute to read.
How it works
The skill checks that the adapter matches the base model, converts the adapter files to GGUF with the llama.cpp conversion script, and shows how to load it at run time.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Fine-tune MiniCPM5-1B โ GGUF LoRA adapter
The framework skills (minicpm5-finetune-*) all emit a PEFT adapter (adapter_model.safetensors + adapter_config.json). But llama.cpp / llama-server โ and the MiniCPM Desk Pet app's custom-LoRA upload โ load a GGUF LoRA adapter (--lora some-adapter.gguf). This skill is the bridge: train a PEFT LoRA, then convert it to GGUF and run/upload it.
This is the path you want when the base model is served as GGUF (Desk Pet, Ollama, LM Studio, plain
llama-server). If you serve the fp16 HF base with vLLM / transformers, you don't need GGUF โ load the PEFT adapter directly.
Pipeline overview
train (any minicpm5-finetune-* skill) this skill
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
BASE (fp16 HF) โโบ adapter_model.safetensors โโบ convert_lora_to_gguf.py โโบ adapter.gguf
adapter_config.json โ
llama-server --lora / Desk Pet upload
Required input
| Var | Example | Default |
|---|---|---|
ADAPTER_DIR |
./runs/minicpm5_unsloth/adapter_final |
required โ a PEFT dir with adapter_config.json + adapter_model.safetensors |
BASE_MODEL |
openbmb/MiniCPM5-1B (HF id) or a local fp16 HF dir |
required โ must be the same base the adapter was trained on |
OUTTYPE |
f16 (recommended) / q8_0 / bf16 / f32 |
f16 |
OUT_GGUF |
./minicpm5-mylora.gguf |
<ADAPTER_DIR>/adapter_model.f16.gguf |
Don't have an adapter yet? First run a training skill โ start from the router
minicpm5-finetune(or go straight tominicpm5-finetune-unslothfor single-GPU LoRA). Come back here withADAPTER_DIRpointing at its output.
Steps
1. Get llama.cpp (has the converter)
git clone --depth=1 https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
pip install -r requirements.txt # converter deps: torch, safetensors, gguf, transformers
convert_lora_to_gguf.py lives at the repo root. You only need the Python script for conversion; build the C++ binaries (step 4) only if you want to test locally.
2. Convert the PEFT adapter โ GGUF
python convert_lora_to_gguf.py "$ADAPTER_DIR" \
--base "$BASE_MODEL" \
--outtype f16 \
--outfile "$OUT_GGUF"
--baseonly needs the base model's config (config.json,tokenizer.json) โ not the weights. A local fp16 HF dir or an HF id both work.- If the base is only on the Hub, use
--base-model-id openbmb/MiniCPM5-1Binstead of--base(it pulls just the config). - Output is a single
.ggufof roughly the same size as the input.safetensors(a 22 MB r=16 adapter โ ~22 MB GGUF).
๐ The #1 gotcha โ
base_model_name_or_pathpoints at the training machine. PEFT writes the absolute path of the base used during training intoadapter_config.json(e.g./user/.../MiniCPM5-models-fixed/official). On any other machine the converter can't find it. Always pass--base(or--base-model-id) explicitly to override it โ don't rely on whatever is baked into the config. The base you pass MUST match the one you trained on, or the adapter math is meaningless.
3. (Optional) Sanity-check the GGUF metadata
python -c "import gguf,sys; r=gguf.GGUFReader('$OUT_GGUF'); print('tensors:', len(r.tensors)); print('arch:', r.get_field('general.architecture').parts[-1].tobytes().decode() if r.get_field('general.architecture') else '?')"
Expect general.type = adapter and a nonzero tensor count. MiniCPM5-1B is a Llama-architecture model, so the converter treats it as llama โ this is correct, not an error.
4. Test with llama-server before shipping
You need a GGUF base model too (the adapter is applied on top of it). Grab the released base:
huggingface-cli download openbmb/MiniCPM5-1B-GGUF MiniCPM5-1B-Q8_0.gguf --local-dir .
Then:
# CLI
llama-cli -m MiniCPM5-1B-Q8_0.gguf --lora "$OUT_GGUF" \
-p "ไฝ ๅฅฝ" -n 128 --temp 0.7 --top-p 0.95
# OpenAI-compatible server
llama-server -m MiniCPM5-1B-Q8_0.gguf --lora "$OUT_GGUF" --port 8080 --jinja
If the persona/behavior you trained shows up, the GGUF is good. If output is identical to the base, the adapter didn't load (check the --lora path and that --base matched in step 2).
Quant compatibility: a GGUF LoRA built from an fp16 adapter applies
FAQ
Does the base model need to match?
Yes. The skill says the adapter must come from the same base model that you convert against.
Do I need to train the adapter first?
Yes. The skill starts from a PEFT adapter made by one of the other MiniCPM5 fine-tuning skills.
Where is the adapter loaded?
It can be loaded with the lora option of llama-server, or uploaded in the MiniCPM Desk Pet app.
Details
Original description by the author
Fine-tune MiniCPM5-1B into a LoRA adapter and convert it to a GGUF adapter that loads directly into llama.cpp / llama-server and the MiniCPM Desk Pet app's custom-LoRA upload. Use when the user wants "GGUF LoRA", "convert LoRA to GGUF", "convert_lora_to_gguf", a custom persona/skin for the desktop pet, "ๆกๅฎ ่ชๅฎไน LoRA", "ไธไผ LoRA ๅฐๆกๅฎ ", or asks how to take a trained adapter and run it on a GGUF base.
repo: OpenBMB/MiniCPM
Popularity
- GitHub stars
- 12k
- Ranking position
- #11540
- License
- Apache-2.0
- Updated
- 9/21/2026
Comments
- โฆ
More skills from this repository
minicpm5-deploy-litert
12kLets your agent run MiniCPM5 models on a computer or Android phone with Google's LiteRT-LM runtime, using one model file.
minicpm5-deploy-llama-cpp
12kShows your agent how to run MiniCPM5 models with llama.cpp on a CPU or a home graphics card, using ready-made GGUF files.
minicpm5-deploy-lmstudio
12kHelps your agent run MiniCPM5 models in LM Studio, a desktop app with a chat window, and start its local OpenAI-style server.
minicpm5-deploy-mlx
12kLets your agent run MiniCPM5 models natively on Apple Silicon Macs with Apple's MLX framework, for fast local chat and text generation.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.