fix: remove quantization_config from config.json to prevent re-quantization
This commit is contained in:
12
train.py
12
train.py
@@ -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"],
|
||||||
|
|||||||
Reference in New Issue
Block a user