Skip to content

Commit

Permalink
take care of case when "_tied_weights_keys" is not an attribute (#3226)
Browse files Browse the repository at this point in the history
* take care of case when "_tied_weights_keys" is not an attribute

Signed-off-by: Yu Chin Fabian Lim <[email protected]>

* fix style

Signed-off-by: Yu Chin Fabian Lim <[email protected]>

---------

Signed-off-by: Yu Chin Fabian Lim <[email protected]>
  • Loading branch information
fabianlim authored Nov 20, 2024
1 parent cf169a1 commit e724c9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/accelerate/utils/fsdp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def merge_fsdp_weights(


def ensure_weights_retied(param_init_fn, model: torch.nn.Module, device: torch.cuda.device):
_tied_names = model._tied_weights_keys
_tied_names = getattr(model, "_tied_weights_keys", None)
if not _tied_names:
# if no tied names just passthrough
return param_init_fn
Expand Down

0 comments on commit e724c9a

Please sign in to comment.