feat: swap to fine-tuned Q4_K_M model (4.68 GB)
Browse files- Q4_K_M quantization complete via llama.cpp
- model_inference.py now uses lfed-qwen2.5-coder-7b-sql-Q4_K_M.gguf
- 4.68 GB vs 15.2 GB F16 — fits Zero GPU comfortably
- modal_train/export_gguf.py +8 -8
- modal_train/modal_app.py +1 -1
- model_inference.py +1 -1
modal_train/export_gguf.py
CHANGED
|
@@ -111,15 +111,15 @@ def convert_to_gguf():
|
|
| 111 |
"--outtype", "f16",
|
| 112 |
], check=True)
|
| 113 |
|
| 114 |
-
# Quantize using llama-
|
| 115 |
print(f" Quantizing to {GGUF_QUANT}...")
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
|
| 124 |
print(f"✅ GGUF saved to {out_path}")
|
| 125 |
return out_path
|
|
|
|
| 111 |
"--outtype", "f16",
|
| 112 |
], check=True)
|
| 113 |
|
| 114 |
+
# Quantize using llama-cpp-python's built-in quantizer
|
| 115 |
print(f" Quantizing to {GGUF_QUANT}...")
|
| 116 |
+
from llama_cpp import llama_quantize
|
| 117 |
+
llama_quantize(
|
| 118 |
+
input_path=str(f16_path),
|
| 119 |
+
output_path=str(out_path),
|
| 120 |
+
output_type=GGUF_QUANT.lower(),
|
| 121 |
+
)
|
| 122 |
+
print(f" Quantized: {out_path}")
|
| 123 |
|
| 124 |
print(f"✅ GGUF saved to {out_path}")
|
| 125 |
return out_path
|
modal_train/modal_app.py
CHANGED
|
@@ -18,7 +18,7 @@ import modal
|
|
| 18 |
|
| 19 |
# ── Modal app ──────────────────────────────────────────────────────────
|
| 20 |
|
| 21 |
-
app = modal.App("kasualdad-lfed-train")
|
| 22 |
|
| 23 |
# ── Image with all dependencies ────────────────────────────────────────
|
| 24 |
|
|
|
|
| 18 |
|
| 19 |
# ── Modal app ──────────────────────────────────────────────────────────
|
| 20 |
|
| 21 |
+
app = modal.App("kasualdad-lfed-train") # force redeploy v3
|
| 22 |
|
| 23 |
# ── Image with all dependencies ────────────────────────────────────────
|
| 24 |
|
model_inference.py
CHANGED
|
@@ -99,7 +99,7 @@ LOCAL_MODEL_PATH = "/tmp/lfed-models/qwen/Qwen2.5-Coder-7B-Instruct.Q4_K_M.gguf"
|
|
| 99 |
|
| 100 |
# Fallback: download from HF Hub (base model, pre-fine-tune)
|
| 101 |
HF_REPO_ID = "build-small-hackathon/lfed-qwen2.5-coder-7b-sql-gguf"
|
| 102 |
-
HF_MODEL_FILE = "
|
| 103 |
|
| 104 |
# Post-Phase-7: swap HF_REPO_ID / HF_MODEL_FILE to the fine-tuned GGUF
|
| 105 |
# after Modal training completes and the model is pushed to HF Hub.
|
|
|
|
| 99 |
|
| 100 |
# Fallback: download from HF Hub (base model, pre-fine-tune)
|
| 101 |
HF_REPO_ID = "build-small-hackathon/lfed-qwen2.5-coder-7b-sql-gguf"
|
| 102 |
+
HF_MODEL_FILE = "lfed-qwen2.5-coder-7b-sql-Q4_K_M.gguf"
|
| 103 |
|
| 104 |
# Post-Phase-7: swap HF_REPO_ID / HF_MODEL_FILE to the fine-tuned GGUF
|
| 105 |
# after Modal training completes and the model is pushed to HF Hub.
|