Skip to content

Commit

Permalink
[Algo] code update
Browse files Browse the repository at this point in the history
Signed-off-by: Lu, Yintong <yintong.lu@intel.com>
  • Loading branch information
yintong-lu committed Nov 2, 2023
1 parent 1455fa2 commit 782fa53
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions neural_compressor/adaptor/torch_utils/smooth_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,7 @@ def _adjust_parameters(
layer_names = absorb_to_layer[key]
for layer_name in layer_names:
input_minmax = [self.input_mins[layer_names[0]], self.input_maxes[layer_names[0]]]
self._scale_layer_weight(
layer_name, weight_scales_info[layer_name], alpha_tmp, input_minmax
) # lyt_os_debug #1101_remove bias_alphas
if self.to_shift_bias: # lyt_os_debug_1101
if self.to_shift_bias: # lyt_os_debug_1101 #1102_moved_B4_scaleLayerweight
z = self.bias_shifts[layer_name]
layer = get_module(self.model, layer_name)
w0 = copy.deepcopy(layer.weight)
Expand All @@ -651,6 +648,10 @@ def _adjust_parameters(
f"lyt_debug weight_bias_created {layer_name}, {layer.bias.size()}, {torch.all(layer.bias==res)}"
)

self._scale_layer_weight(
layer_name, weight_scales_info[layer_name], alpha_tmp, input_minmax
) # lyt_os_debug #1101_remove bias_alphas

return weight_scales_info, absorb_scales_info

def absorb_bias_alphas(self, bias_alphas=None): # lyt_os_debug_1031
Expand Down

0 comments on commit 782fa53

Please sign in to comment.