fix: remove quantization_config from config.json to prevent re-quantization

This commit is contained in:
Christian Medina
2026-07-03 01:24:25 -04:00
parent 1c3da52028
commit 6f45390be8

View File

@@ -64,6 +64,18 @@ def train(config_path):
json.dump(index, f) json.dump(index, f)
print(f"✓ Created index: {index_file} ({len(weight_map)} weights mapped)") 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...") print(f"\n[INFO] Loading pre-quantized BnB 4-bit model...")
model = AutoModelForCausalLM.from_pretrained( model = AutoModelForCausalLM.from_pretrained(
config["base_model"], config["base_model"],