Skip to content

Commit

Permalink
add runtimeError
Browse files Browse the repository at this point in the history
  • Loading branch information
eitanturok committed Sep 26, 2024
1 parent 7e3ad71 commit 39a92ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llmfoundry/models/utils/tp_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def ffn_tp_strategy(model: ComposerModel) -> dict[str, ParallelStyle]:
layer for layer in TP_LAYERS for name, _ in model.named_modules()
if layer in name
}
assert tp_layers_in_model == TP_LAYERS, f'The FFN tensor parallelism strategy requires `model` to have layers {TP_LAYERS}. But `model` is missing layers {TP_LAYERS - tp_layers_in_model}.'
if tp_layers_in_model != TP_LAYERS:
raise RuntimeError(
f'The FFN tensor parallelism strategy requires `model` to have layers {TP_LAYERS}. But `model` is missing layers {TP_LAYERS - tp_layers_in_model}.'
)

# generate layer plan
layer_plan: dict[str, ParallelStyle] = {}
Expand Down

0 comments on commit 39a92ad

Please sign in to comment.