Skip to content

Commit

Permalink
Enable check_reduction for imagenet flow and fairseq
Browse files Browse the repository at this point in the history
Summary:
As the title says, better to enable this for certain use cases to make
sure things are right

Reviewed By: myleott, pietern

Differential Revision: D13351753

fbshipit-source-id: cf495960fda71ebd679c23212e19703c93a9dbdc
  • Loading branch information
teng-li authored and facebook-github-bot committed Dec 6, 2018
1 parent 776e9ce commit 50591a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fairseq/models/distributed_fairseq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.

import inspect
from torch.nn import parallel

from fairseq.distributed_utils import c10d_status
Expand Down Expand Up @@ -46,6 +47,10 @@ def DistributedFairseqModel(args, model):
broadcast_buffers=False,
bucket_cap_mb=args.bucket_cap_mb,
)
# Maintain backward compatibility for 0.4 or earlier
if 'check_reduction' in inspect.getargspec(ddp_class)[0]:
init_kwargs['check_reduction'] = True

elif args.ddp_backend == 'no_c10d':
ddp_class = LegacyDistributedDataParallel
init_kwargs = dict(
Expand Down

0 comments on commit 50591a2

Please sign in to comment.