DevGwardo's picture
v4: oversampled abstention + metric fix
17b0632 verified
|
Raw History Blame Contribute Delete
2.32 kB

GGUF build (MiniCPM5-1B toolcall)

Builds f16, Q8_0, and Q4_K_M GGUF files from the merged DevGwardo/minicpm5-1b-toolcall LoRA via pipeline/make_gguf.ps1.

Prerequisites

  • pipeline/merge_local.py (merges the LoRA into the base, writes .\merged)
  • llama.cpp-src\convert_hf_to_gguf.py (llama.cpp master checkout)
  • llama-bin\llama-quantize.exe (release b12931)
  • .venv\Scripts\python.exe with torch, transformers, peft, gguf, numpy

Commands

Full pipeline (merge + convert + quantize), run from the project root:

powershell -NoProfile -File pipeline\make_gguf.ps1

Convert + quantize only (requires .\merged\config.json to already exist):

powershell -NoProfile -File pipeline\make_gguf.ps1 -SkipMerge

Custom directories (both relative to the project root unless absolute):

powershell -NoProfile -File pipeline\make_gguf.ps1 -OutDir gguf -MergedDir merged

Manual equivalents of what the script runs:

# 1) Merge (skipped automatically when merged\config.json exists)
.venv\Scripts\python.exe pipeline\merge_local.py

# 2) Convert merged dir -> f16 GGUF
.venv\Scripts\python.exe llama.cpp-src\convert_hf_to_gguf.py merged --outfile gguf\minicpm5-1b-toolcall-f16.gguf --outtype f16

# 3) Quantize
llama-bin\llama-quantize.exe gguf\minicpm5-1b-toolcall-f16.gguf gguf\minicpm5-1b-toolcall-Q8_0.gguf Q8_0
llama-bin\llama-quantize.exe gguf\minicpm5-1b-toolcall-f16.gguf gguf\minicpm5-1b-toolcall-Q4_K_M.gguf Q4_K_M

The script is idempotent: re-running it reuses .\merged when merged\config.json exists and overwrites the GGUF outputs.

Expected outputs and sizes

File Approx. size
gguf\minicpm5-1b-toolcall-f16.gguf ~2.2 GB
gguf\minicpm5-1b-toolcall-Q8_0.gguf ~1.2 GB
gguf\minicpm5-1b-toolcall-Q4_K_M.gguf ~0.8 GB

The script prints a file/size table at the end and exits non-zero on any failure (native calls are checked via $LASTEXITCODE).

Serve

.\llama-bin\llama-server.exe -m .\gguf\minicpm5-1b-toolcall-Q4_K_M.gguf -c 4096 --jinja --port 8080

Runtime note: use a llama.cpp build >= b9833, which contains the native MiniCPM5 tool-call parser. Older builds will serve the model but cannot parse its tool calls.