Skip to content

Commit

Permalink
Fix (bias_correction): Typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfraser committed May 30, 2024
1 parent fb9b257 commit d264a7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/brevitas/graph/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ def apply_correction(self, model):
module.bias.data += correction
elif self.skip_if_no_bias is False:
# When accelerate is enabled, bring tensors onto the device to avoid allocating a meta parameter.
if hasattr(self.layer, 'allocate_params'):
self.layer.allocate_params(self.layer)
if hasattr(module, 'allocate_params'):
module.allocate_params(module)
module.register_parameter(
'bias', nn.Parameter(correction).to(module.weight.device))
# Offload params again
if hasattr(self.layer, 'offload_params'):
self.layer.offload_params(self.layer)
if hasattr(module, 'offload_params'):
module.offload_params(module)

def compute_correct_bias(self, module, inp, name):
inp = self.unpack_input(inp)
Expand Down

0 comments on commit d264a7c

Please sign in to comment.