Skip to content

Commit

Permalink
Remove DDP MultiHeadAttention fix (ultralytics#3768)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jun 25, 2021
1 parent 584a9b0 commit 406eb70
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary

# DDP mode
if cuda and RANK != -1:
model = DDP(model, device_ids=[LOCAL_RANK], output_device=LOCAL_RANK,
# nn.MultiheadAttention incompatibility with DDP https://github.com/pytorch/pytorch/issues/26698
find_unused_parameters=any(isinstance(layer, nn.MultiheadAttention) for layer in model.modules()))
model = DDP(model, device_ids=[LOCAL_RANK], output_device=LOCAL_RANK)

# Model parameters
hyp['box'] *= 3. / nl # scale to layers
Expand Down

0 comments on commit 406eb70

Please sign in to comment.