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 14, 2024
1 parent 6b93e65 commit 9de6e2f
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 @@ -272,7 +272,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 @@ -281,9 +281,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 9de6e2f

Please sign in to comment.