Skip to content

Commit edbc611

Browse files
committed
use new quant loader
1 parent 345b6de commit edbc611

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22
import os
3-
import sys
43
import time
54
import zipfile
65
from pathlib import Path
@@ -35,14 +34,15 @@
3534
ds_config = generate_ds_config(shared.args.bf16, 1 * world_size, shared.args.nvme_offload_dir)
3635
dschf = HfDeepSpeedConfig(ds_config) # Keep this object alive for the Transformers integration
3736

37+
3838
def load_model(model_name):
3939
print(f"Loading {model_name}...")
4040
t0 = time.time()
4141

4242
shared.is_RWKV = model_name.lower().startswith('rwkv-')
4343

4444
# Default settings
45-
if not any([shared.args.cpu, shared.args.load_in_8bit, shared.args.load_in_4bit, shared.args.gptq_bits > 0, shared.args.auto_devices, shared.args.disk, shared.args.gpu_memory is not None, shared.args.cpu_memory is not None, shared.args.deepspeed, shared.args.flexgen, shared.is_RWKV]):
45+
if not any([shared.args.cpu, shared.args.load_in_8bit, shared.args.gptq_bits, shared.args.auto_devices, shared.args.disk, shared.args.gpu_memory is not None, shared.args.cpu_memory is not None, shared.args.deepspeed, shared.args.flexgen, shared.is_RWKV]):
4646
if any(size in shared.model_name.lower() for size in ('13b', '20b', '30b')):
4747
model = AutoModelForCausalLM.from_pretrained(Path(f"models/{shared.model_name}"), device_map='auto', load_in_8bit=True)
4848
else:
@@ -87,11 +87,11 @@ def load_model(model_name):
8787

8888
return model, tokenizer
8989

90-
# 4-bit LLaMA
91-
elif shared.args.gptq_bits > 0 or shared.args.load_in_4bit:
92-
from modules.quantized_LLaMA import load_quantized_LLaMA
90+
# Quantized model
91+
elif shared.args.gptq_bits > 0:
92+
from modules.quant_loader import load_quant
9393

94-
model = load_quantized_LLaMA(model_name)
94+
model = load_quant(model_name, shared.args.gptq_model_type)
9595

9696
# Custom
9797
else:

0 commit comments

Comments
 (0)