Langsung ke konten
Skillpedia
Machine learning12k ยท #11540

minicpm5-finetune-gguf-lora

Fungsinya

Skill ini memandu AI Anda membuat adapter LoRA untuk MiniCPM5-1B dan mengubahnya ke format GGUF. Skill ini ditujukan untuk orang yang menjalankan MiniCPM5 sebagai model GGUF dan menginginkan versi khusus.

Kapan dipakai

  • โœ“Saat Anda memiliki adapter LoRA yang sudah dilatih dan ingin memuatnya ke llama-server.
  • โœ“Saat Anda ingin mengonversi adapter LoRA dengan skrip convert_lora_to_gguf.
  • โœ“Saat Anda ingin mengunggah persona atau kulit khusus ke aplikasi MiniCPM Desk Pet.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-finetune-gguf-lora/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œUbah adapter LoRA MiniCPM5-1B yang sudah saya latih menjadi berkas GGUF yang bisa dimuat llama-server.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill memastikan adapter cocok dengan model dasar, mengonversi berkas adapter ke GGUF dengan skrip konversi llama.cpp, dan menunjukkan cara memuatnya saat berjalan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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 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)

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"
  • --base only 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-1B instead of --base (it pulls just the config).
  • Output is a single .gguf of roughly the same size as the input .safetensors (a 22 MB r=16 adapter โ†’ ~22 MB GGUF).

๐Ÿ”‘ The #1 gotcha โ€” base_model_name_or_path points at the training machine. PEFT writes the absolute path of the base used during training into adapter_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

Pertanyaan umum

Apakah model dasar harus cocok?

Ya. Skill menyatakan adapter harus berasal dari model dasar yang sama dengan yang dikonversi.

Apakah saya perlu melatih adapter terlebih dahulu?

Ya. Skill dimulai dari adapter PEFT yang dibuat oleh salah satu skill fine-tuning MiniCPM5 lainnya.

Di mana adapter dimuat?

Adapter dapat dimuat dengan opsi lora pada llama-server, atau diunggah di aplikasi MiniCPM Desk Pet.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
12k
Peringkat
#11540
Lisensi
Apache-2.0
Diperbarui
21/9/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa