Skip to content

Commit

Permalink
fix bias
Browse files Browse the repository at this point in the history
  • Loading branch information
SunMarc committed Mar 13, 2024
1 parent ba9f251 commit 9b4b416
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion quanto/nn/qmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def deserialize_tensor_subclass(t, state_dict, prefix):
# FIXME: here we should copy frozen weights into frozen module, but this leads to grad error
self.weight = torch.nn.Parameter(deserialized_weight.to(device))
# this is needed because we can't load it correctly when the bias is on the meta device
self.bias = torch.nn.Parameter(state_dict.pop(prefix + "bias"))
if state_dict.get(prefix + "bias", False):
self.bias = torch.nn.Parameter(state_dict.pop(prefix + "bias"))
super()._load_from_state_dict(
state_dict, prefix, local_metadata, False, missing_keys, unexpected_keys, error_msgs
)
Expand Down

0 comments on commit 9b4b416

Please sign in to comment.