Skip to content

Commit

Permalink
[skip ci] ref/pascal voc, Removed temporary fix for hvd
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Feb 27, 2023
1 parent b8ada65 commit 06e80fc
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions examples/references/segmentation/pascal_voc2012/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,7 @@ def initialize(config):

# Adapt model to dist config
model = idist.auto_model(model)

if idist.backend() == "horovod":
accumulation_steps = config.get("accumulation_steps", 1)
# Can not use auto_optim with Horovod: https://github.com/horovod/horovod/issues/2670
import horovod.torch as hvd

optimizer = hvd.DistributedOptimizer(
optimizer, named_parameters=model.named_parameters(), backward_passes_per_step=accumulation_steps
)
hvd.broadcast_optimizer_state(optimizer, root_rank=0)
if accumulation_steps > 1:
# disable manual grads accumulation as it is already done on optimizer's side
config.accumulation_steps = 1
else:
optimizer = idist.auto_optim(optimizer)
optimizer = idist.auto_optim(optimizer)
criterion = config.criterion.to(device)

return model, optimizer, criterion
Expand Down

0 comments on commit 06e80fc

Please sign in to comment.