Skip to content

Commit 399cd44

Browse files
authored
Remove the save of gptq config (#1993)
Signed-off-by: Kaihui-intel <[email protected]>
1 parent 05272c4 commit 399cd44

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

neural_compressor/torch/algorithms/weight_only/gptq.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -930,12 +930,7 @@ def tmp(_, inp, out):
930930

931931
logger.info("Quantization done")
932932
# self.model.config.use_cache = self.use_cache
933-
934-
# obtain model (all weight only quantization API function should return)
935-
for k, v in gptq_config.items():
936-
for m, n in v.items():
937-
gptq_config[k][m] = n.tolist()
938-
return self.model, gptq_config
933+
return self.model
939934

940935

941936
class GPTQ:
@@ -1379,9 +1374,8 @@ def convert(self, model, *args, **kwargs):
13791374
self.gptq_quantizer.model = model
13801375
self.gptq_quantizer.remove_prepare_for_calibration()
13811376

1382-
q_model, gptq_config = self.gptq_quantizer.execute_quantization()
1377+
q_model = self.gptq_quantizer.execute_quantization()
13831378
if not self.gptq_quantizer.use_layer_wise:
13841379
q_model = q_model.to(self.model_device)
1385-
q_model.gptq_config = gptq_config
13861380
logger.info("GPTQ quantizing done.")
13871381
return q_model

neural_compressor/torch/algorithms/weight_only/save_load.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ def save(model, output_dir="./saved_results"):
5353
# saving process
5454
save_config_mapping(model.qconfig, qconfig_file_path)
5555

56-
if hasattr(model, "gptq_config") and model.gptq_config:
57-
gptq_config_path = os.path.join(os.path.abspath(os.path.expanduser(output_dir)), "gptq_config.json")
58-
with open(gptq_config_path, "w") as f:
59-
json.dump(model.gptq_config, f, indent=4)
60-
6156
# MethodType 'save' not in state_dict
6257
del model.save
6358
torch.save(model.state_dict(), qmodel_weight_file_path)

0 commit comments

Comments
 (0)