Commit b599fdb1 authored by Max Ryabinin's avatar Max Ryabinin
Browse files

Only rearrange weight if it exists

parent c1f3f56d
...@@ -307,7 +307,10 @@ class Int8Params(torch.nn.Parameter): ...@@ -307,7 +307,10 @@ class Int8Params(torch.nn.Parameter):
def maybe_rearrange_weight(state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs): def maybe_rearrange_weight(state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
weight = state_dict[f"{prefix}weight"] weight = state_dict.get(f"{prefix}weight")
if weight is None:
# if the state dict has no weights for this layer (e.g., LoRA finetuning), do nothing
return
weight_format = state_dict.pop(f"{prefix}weight_format", "row") weight_format = state_dict.pop(f"{prefix}weight_format", "row")
if weight_format != "row": if weight_format != "row":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment