Skip to content

Commit 601c8f9

Browse files
committed
add guard for self.weight.quant_state attribute
1 parent e6ccde2 commit 601c8f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bitsandbytes/nn/modules.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,10 @@ def _save_to_state_dict(self, destination, prefix, keep_vars):
515515
save weight and bias,
516516
then fill state_dict with components of quant_state
517517
"""
518-
if getattr(self.weight.quant_state, "packing_format_for_cpu", False):
518+
if (
519+
getattr(self.weight, "quant_state", None) is not None
520+
and getattr(self.weight.quant_state, "packing_format_for_cpu", False)
521+
):
519522
self.weight.data, self.weight.quant_state = _convert_weight_packed_for_cpu_inverse(
520523
self.weight.data, self.weight.quant_state
521524
)

0 commit comments

Comments
 (0)