@@ -39,7 +39,7 @@ def __init__(self, model, slim_config=None):
3939 self .quant_model = model
4040 # init ptq config of model
4141 self .quant_model .init_ptq (slim_config )
42- self .model_path = slim_config . get ( "model_path" )
42+ self .absolute_model_path = slim_config [ "global_config" ]. absolute_model_path
4343 self .quant_algo = self .quant_model .quant_config .quant_algo
4444 self .quant_helpers = self .quant_model .quant_config .quant_helpers
4545 if (
@@ -213,12 +213,15 @@ def _convert(self):
213213 ):
214214 if sub_layer .weight .device .type == "meta" :
215215 with open (
216- os .path .join (self .model_path , "model.safetensors.index.json" ),
216+ os .path .join (
217+ self .absolute_model_path , "model.safetensors.index.json"
218+ ),
217219 "r" ,
218220 ) as f :
219221 model_index = json .load (f )
220222 orign_w_file = os .path .join (
221- self .model_path , model_index ["weight_map" ][name + ".weight" ]
223+ self .absolute_model_path ,
224+ model_index ["weight_map" ][name + ".weight" ],
222225 )
223226 orign_w = load_file (orign_w_file , device = "cpu" )
224227 print_info (f"Load meta weight { name } from file { orign_w_file } " )
@@ -228,7 +231,7 @@ def _convert(self):
228231 if hasattr (sub_layer , "bias" ):
229232 if (name + ".bias" ) in model_index ["weight_map" ]:
230233 orign_b_file = os .path .join (
231- self .model_path ,
234+ self .absolute_model_path ,
232235 model_index ["weight_map" ][name + ".bias" ],
233236 )
234237 orign_b = load_file (orign_b_file , device = "cpu" )
0 commit comments