Commit 866d0d2e authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Fix --ddp-backend=no_c10d for params that don't require grads

Summary: Pull Request resolved: https://github.com/pytorch/fairseq/pull/388

Reviewed By: theweiho

Differential Revision: D13244869

fbshipit-source-id: d22c18f63f9a691ccc7245e06bc9a5b776a192b5
parent 07e34244
...@@ -166,4 +166,5 @@ class LegacyDistributedDataParallel(nn.Module): ...@@ -166,4 +166,5 @@ class LegacyDistributedDataParallel(nn.Module):
def allreduce_hook(*unused): def allreduce_hook(*unused):
Variable._execution_engine.queue_callback(reduction_fn) Variable._execution_engine.queue_callback(reduction_fn)
p.register_hook(allreduce_hook) if p.requires_grad:
p.register_hook(allreduce_hook)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment