From 6f45390be8307b1aa84093518c54896a95a8c2bb Mon Sep 17 00:00:00 2001 From: Christian Medina <37550954+cmedinasoriano@users.noreply.github.com> Date: Fri, 3 Jul 2026 01:24:25 -0400 Subject: [PATCH] fix: remove quantization_config from config.json to prevent re-quantization --- train.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/train.py b/train.py index 13f344e..472f836 100644 --- a/train.py +++ b/train.py @@ -64,6 +64,18 @@ def train(config_path): json.dump(index, f) print(f"✓ Created index: {index_file} ({len(weight_map)} weights mapped)") + # Remove quantization_config from config.json to prevent re-quantization + import json as json_mod + config_json_path = Path(config["base_model"]) / "config.json" + if config_json_path.exists(): + with open(config_json_path, 'r') as f: + config_data = json_mod.load(f) + if 'quantization_config' in config_data: + del config_data['quantization_config'] + with open(config_json_path, 'w') as f: + json_mod.dump(config_data, f) + print(f"✓ Removed quantization_config from config.json") + print(f"\n[INFO] Loading pre-quantized BnB 4-bit model...") model = AutoModelForCausalLM.from_pretrained( config["base_model"],