Skip to content

Commit

Permalink
fix undefined variables
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Marty <[email protected]>
  • Loading branch information
fxmarty-amd committed Feb 7, 2025
1 parent 1dd6f1c commit 1eacf30
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def process_weights_after_loading(self, layer) -> None:
weight=layer.weight,
weight_scale=layer.weight_scale,
input_scale=layer.input_scale)
if input_scale is not None:
layer.input_scale = Parameter(input_scale,
requires_grad=False)
else:
max_w_scale = layer.weight_scale
weight = layer.weight
input_scale = layer.input_scape

max_w_scale, weight = requantize_with_max_scale(
weight=weight,
Expand All @@ -49,6 +50,8 @@ def process_weights_after_loading(self, layer) -> None:

layer.weight = Parameter(weight.t(), requires_grad=False)
layer.weight_scale = Parameter(max_w_scale, requires_grad=False)
if input_scale is not None:
layer.input_scale = Parameter(input_scale, requires_grad=False)

# If channelwise, scales are already lined up, so just transpose.
elif self.qscheme == "per_channel":
Expand Down

0 comments on commit 1eacf30

Please sign in to comment.