Kasualdad commited on
Commit
e0c4e2f
·
1 Parent(s): 31c493f

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 CHANGED
@@ -111,15 +111,15 @@ def convert_to_gguf():
111
  "--outtype", "f16",
112
  ], check=True)
113
 
114
- # Quantize using llama-quantize (built-in to llama-cpp-python)
115
  print(f" Quantizing to {GGUF_QUANT}...")
116
- quantize_bin = shutil.which("llama-quantize") or shutil.which("quantize")
117
- if quantize_bin:
118
- subprocess.run([quantize_bin, str(f16_path), str(out_path), GGUF_QUANT], check=True)
119
- else:
120
- # Fallback: use the FP16 GGUF directly
121
- print(" ⚠️ llama-quantize not found, using FP16 GGUF")
122
- out_path = f16_path
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 = "model-f16.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.
 
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.