Skip to content

Commit

Permalink
fix: correct serialization of non-affine QLayerNorm
Browse files Browse the repository at this point in the history
  • Loading branch information
DN6 committed Feb 14, 2025
1 parent 2202f84 commit 1801dbc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion optimum/quanto/nn/qmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def disable_output_quantization(self):
def _save_to_state_dict(self, destination, prefix, keep_vars):
if self.weight_qtype is None or not self.frozen:
# Save standard weight Tensor
destination[prefix + "weight"] = self.weight if keep_vars else self.weight.detach()
destination[prefix + "weight"] = (
self.weight if (self.weight is None or keep_vars) else self.weight.detach()
)
else:
# Save QTensor using dedicated method
self.weight.save_to_state_dict(destination, prefix + "weight.", keep_vars)
Expand Down

0 comments on commit 1801dbc

Please sign in to comment.