File size: 1,807 Bytes
2ad51d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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