Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bitsandbytes/nn/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,10 @@ def _save_to_state_dict(self, destination, prefix, keep_vars):
save weight and bias,
then fill state_dict with components of quant_state
"""
if getattr(self.weight.quant_state, "packing_format_for_cpu", False):
if (
getattr(self.weight, "quant_state", None) is not None
and getattr(self.weight.quant_state, "packing_format_for_cpu", False)
):
self.weight.data, self.weight.quant_state = _convert_weight_packed_for_cpu_inverse(
self.weight.data, self.weight.quant_state
)
Expand Down