diff --git a/modules/model_quant_nncf.py b/modules/model_quant_nncf.py index 4f0b86e5c..89e5e7724 100644 --- a/modules/model_quant_nncf.py +++ b/modules/model_quant_nncf.py @@ -47,7 +47,6 @@ def nncf_compress_layer(layer, num_bits, is_asym_mode, torch_dtype=None, quant_c if layer.__class__.__name__ in allowed_types: if torch_dtype is None: torch_dtype = devices.dtype - layer.weight.data = layer.weight.data.float() if layer.__class__.__name__ in conv_types: if is_asym_mode or not quant_conv: # don't quant convs with asym mode @@ -60,6 +59,8 @@ def nncf_compress_layer(layer, num_bits, is_asym_mode, torch_dtype=None, quant_c else: reduction_axes = [layer.weight.ndim - 1] + layer.weight.data = layer.weight.data.float() + if is_asym_mode: level_low = 0 level_high = 2**num_bits - 1