Skip to content

Commit

Permalink
check str or list dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
cli99 committed Dec 1, 2023
1 parent 3d6506b commit eddccc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions llmfoundry/models/mpt/modeling_mpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,12 @@ def fsdp_wrap_fn(self, module: nn.Module) -> bool:
def activation_checkpointing_fn(self, module: nn.Module) -> bool:
act_ckpt_list = getattr(self.config, 'activation_checkpointing_target',
None) or ['MPTBlock']
if not isinstance(act_ckpt_list, list):
# `activation_checkpointing_target` is a single value
if isinstance(act_ckpt_list, str):
act_ckpt_list = [act_ckpt_list]
elif not isinstance(act_ckpt_list, list):
raise ValueError(
f'activation_checkpointing_target must be either a single string or a list, but got {type(act_ckpt_list)}'
)

if 'MPTBlock' in act_ckpt_list or 'mptblock' in act_ckpt_list:
if len(act_ckpt_list) > 1:
Expand Down

0 comments on commit eddccc2

Please sign in to comment.