Skip to content

Commit

Permalink
Prevent FDSP wrapping empty embedding LoRA attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
josejg committed Oct 30, 2023
1 parent 7f72c25 commit 02d949c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions llmfoundry/models/hf/hf_fsdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ def prepare_hf_causal_lm_model_for_fsdp(model: PreTrainedModel,
lora_model_type): # we have built a LoraModel
if model_block is not None: # for pyright
for name, module in model_block.named_modules():
if 'lora' in name: # peft adds modules named with lora
module._fsdp_wrap = True
if 'lora' in name and 'default' in name:
for _ in module.parameters():
module._fsdp_wrap = True
continue

# FSDP Wrap and Activation Checkpoint every model block
model.fsdp_wrap_fn = lambda module: isinstance(module, block_type)
Expand Down

0 comments on commit 02d949c

Please sign in to comment.