# Minicpm5 Finetune Gguf Lora

Fine-tune MiniCPM5-1B into a LoRA adapter and convert it to a GGUF adapter that loads...

- Repository: https://github.com/OpenBMB/MiniCPM (11776 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-09-21
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add OpenBMB/MiniCPM --skill minicpm5-finetune-gguf-lora -g -a claude-code -y`
Codex: `npx skills add OpenBMB/MiniCPM --skill minicpm5-finetune-gguf-lora -g -a codex -y`
Cursor: `npx skills add OpenBMB/MiniCPM --skill minicpm5-finetune-gguf-lora -g -a cursor -y`
Gemini CLI: `npx skills add OpenBMB/MiniCPM --skill minicpm5-finetune-gguf-lora -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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 to **`minicpm5-finetune-unsloth`** for single-GPU LoRA). Come back here with `ADAPTER_DIR` pointing at its output.

## Steps

### 1. Get llama.cpp (has the converter)

The rest: https://github.com/OpenBMB/MiniCPM/blob/HEAD/skills/minicpm5-finetune-gguf-lora/SKILL.md
