Davidmg0815's picture
Upload bench/convert.sh with huggingface_hub
2ad51d5 verified
Raw
History Blame Contribute Delete
1.81 kB
#!/usr/bin/env bash
# Checkpoint -> drei GGUFs: Zielmodell, MTP-Draft, mmproj (Vision).
# Quelle darf BF16 ODER FP8 sein: ModelBase.dequant_model() in base.py:437
# dequantisiert quant_method=="fp8" generisch ueber weight_block_size.
# Laeuft komplett im frischen llama.cpp-Container, der Host braucht kein nvcc.
# Aufruf: ./convert.sh /mnt/models/qwen3.8-27b-fp8
set -euo pipefail
SRC="${1:?Quellverzeichnis mit den .safetensors angeben}"
OUT=/mnt/models/PropellerA-models
IMG=ghcr.io/ggml-org/llama.cpp:full-cuda
NAME=qwen3.8-27b
# Das Image hat /app/tools.sh als Entrypoint — python3 muss explizit gesetzt
# werden, sonst landen die Argumente bei tools.sh und es gibt nur die Hilfe.
D() { sudo docker run --rm -v /mnt/models:/mnt/models -w /app \
--entrypoint /usr/bin/python3 "$IMG" "$@"; }
# eigener Wrapper: --entrypoint muss VOR den Imagenamen
Q() { sudo docker run --rm -v /mnt/models:/mnt/models -w /app \
--entrypoint /app/llama-quantize "$IMG" "$@"; }
# BF16 als Zwischenstufe, NICHT q8_0: aus q8_0 nach Q6_K zu requantisieren
# wuerde den FP8-Fehler ein drittes Mal aufaddieren.
echo "### 1/4 Zielmodell BF16 (ohne MTP-Tensoren) — ca. 54 GB Zwischendatei"
D convert_hf_to_gguf.py "$SRC" \
--outfile "/mnt/models/tmp-$NAME-BF16.gguf" --outtype bf16 --no-mtp
echo "### 2/4 MTP-Draft als eigene Datei"
D convert_hf_to_gguf.py "$SRC" \
--outfile "$OUT/$NAME-MTP-Q8_0.gguf" --outtype q8_0 --mtp
echo "### 3/4 mmproj (Vision/Video)"
D convert_hf_to_gguf.py "$SRC" \
--outfile "$OUT/$NAME-mmproj-F16.gguf" --outtype f16 --mmproj
echo "### 4/4 Zielmodell auf Q6_K quantisieren"
Q "/mnt/models/tmp-$NAME-BF16.gguf" "$OUT/$NAME-Q6_K.gguf" Q6_K
echo
echo "Fertig. Zwischendatei loeschen wenn der Testlauf sitzt:"
echo " rm /mnt/models/tmp-$NAME-BF16.gguf"
ls -lh "$OUT"/$NAME-* 2>/dev/null