Skip to content

Commit

Permalink
Fix layer insertion order in transformer LP
Browse files Browse the repository at this point in the history
  • Loading branch information
tbennun committed Feb 7, 2024
1 parent d968f30 commit f1579de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applications/nlp/transformer/parallelism.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def apply_layer_parallelism_postamble(model: lbann.Model,
# Inject interim layers for each grid and reconnect
for dst_grid, children in unique_grids.items():
interim = lbann.Identity(layer, grid_tag=dst_grid)
layers_to_insert.append((i, interim))
layers_to_insert.append((i+1, interim))

# Reconnect parents
for child in children:
Expand All @@ -272,9 +272,9 @@ def apply_layer_parallelism_postamble(model: lbann.Model,
cind = layer.children.index(child)
new_children[cind] = interim

# Reconnect children
# Reconnect and condense children
if unique_grids:
layer.children = new_children
layer.children = list(set(new_children))

# Add identity layers to the traversed graph right after the source layer
# was computed
Expand Down

0 comments on commit f1579de

Please sign in to comment.