@@ -287,12 +287,13 @@ def _from_pretrained(
287
287
# load the UNet model uncompressed to apply hybrid quantization further
288
288
unet = cls .load_model (unet_path )
289
289
# Apply weights compression to other `components` without dataset
290
- q_config_params = quantization_config .__dict__
291
- wc_params = {param : value for param , value in q_config_params .items () if param != "dataset" }
292
- wc_quantization_config = OVWeightQuantizationConfig .from_dict (wc_params )
290
+ weight_quantization_params = {
291
+ param : value for param , value in quantization_config .__dict__ .items () if param != "dataset"
292
+ }
293
+ weight_quantization_config = OVWeightQuantizationConfig .from_dict (weight_quantization_params )
293
294
else :
294
- wc_quantization_config = quantization_config
295
- unet = cls .load_model (unet_path , wc_quantization_config )
295
+ weight_quantization_config = quantization_config
296
+ unet = cls .load_model (unet_path , weight_quantization_config )
296
297
297
298
components = {
298
299
"vae_encoder" : new_model_save_dir / DIFFUSION_MODEL_VAE_ENCODER_SUBFOLDER / vae_encoder_file_name ,
@@ -302,7 +303,7 @@ def _from_pretrained(
302
303
}
303
304
304
305
for key , value in components .items ():
305
- components [key ] = cls .load_model (value , wc_quantization_config ) if value .is_file () else None
306
+ components [key ] = cls .load_model (value , weight_quantization_config ) if value .is_file () else None
306
307
307
308
if model_save_dir is None :
308
309
model_save_dir = new_model_save_dir
@@ -323,7 +324,7 @@ def _from_pretrained(
323
324
324
325
from .quantization import _hybrid_quantization
325
326
326
- unet = _hybrid_quantization (sd_model .unet .model , wc_quantization_config , dataset = unet_inputs )
327
+ unet = _hybrid_quantization (sd_model .unet .model , weight_quantization_config , dataset = unet_inputs )
327
328
328
329
return cls (
329
330
unet = unet ,
0 commit comments