Datasets:
GGUF q8_0 export with --no-mtp/--disable-vision fallbacks
Browse files- scripts/gguf_export.py +13 -3
scripts/gguf_export.py
CHANGED
|
@@ -11,6 +11,7 @@ def sh(cmd, **kw):
|
|
| 11 |
|
| 12 |
# deps for llama.cpp's converter
|
| 13 |
sh("pip install -q --no-cache-dir gguf numpy 'torch<3' transformers sentencepiece protobuf || true")
|
|
|
|
| 14 |
if not os.path.isdir(f"{WORK}/llama.cpp"):
|
| 15 |
sh(f"git clone --depth 1 https://github.com/ggml-org/llama.cpp {WORK}/llama.cpp")
|
| 16 |
|
|
@@ -19,9 +20,18 @@ local = snapshot_download(REPO)
|
|
| 19 |
print("model at", local, flush=True)
|
| 20 |
|
| 21 |
out = f"{WORK}/ffmpeg-nl2cmd-0.8B-q8_0.gguf"
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
sys.exit(1)
|
| 26 |
print("gguf size:", os.path.getsize(out), flush=True)
|
| 27 |
|
|
|
|
| 11 |
|
| 12 |
# deps for llama.cpp's converter
|
| 13 |
sh("pip install -q --no-cache-dir gguf numpy 'torch<3' transformers sentencepiece protobuf || true")
|
| 14 |
+
sh("apt-get update -qq && apt-get install -y -qq git >/dev/null 2>&1 || true")
|
| 15 |
if not os.path.isdir(f"{WORK}/llama.cpp"):
|
| 16 |
sh(f"git clone --depth 1 https://github.com/ggml-org/llama.cpp {WORK}/llama.cpp")
|
| 17 |
|
|
|
|
| 20 |
print("model at", local, flush=True)
|
| 21 |
|
| 22 |
out = f"{WORK}/ffmpeg-nl2cmd-0.8B-q8_0.gguf"
|
| 23 |
+
import sys
|
| 24 |
+
ok = False
|
| 25 |
+
for extra in ([], ["--no-mtp"], ["--no-mtp", "--disable-vision"]):
|
| 26 |
+
r = sh(f"python {WORK}/llama.cpp/convert_hf_to_gguf.py {local} --outfile {out} --outtype q8_0 " +
|
| 27 |
+
" ".join(extra))
|
| 28 |
+
if r.returncode == 0 and os.path.exists(out):
|
| 29 |
+
print("converted with extra args:", extra, flush=True)
|
| 30 |
+
ok = True
|
| 31 |
+
break
|
| 32 |
+
print("conversion failed with extra args:", extra, flush=True)
|
| 33 |
+
if not ok:
|
| 34 |
+
print("CONVERT_FAILED (all fallbacks)", flush=True)
|
| 35 |
sys.exit(1)
|
| 36 |
print("gguf size:", os.path.getsize(out), flush=True)
|
| 37 |
|