Unverified Commit e7e0c89f authored by Zijian He's avatar Zijian He Committed by GitHub
Browse files

fix the bug (#472) (#484)



* fix the bug (#472)

* fix the bug (#472)

* fix the bug (#472)
Co-authored-by: default avatarhezijian <hezijian@dm-ai.cn>
parent 51c65c97
...@@ -6,4 +6,9 @@ from .hook import HOOKS, Hook ...@@ -6,4 +6,9 @@ from .hook import HOOKS, Hook
class DistSamplerSeedHook(Hook): class DistSamplerSeedHook(Hook):
def before_epoch(self, runner): def before_epoch(self, runner):
runner.data_loader.sampler.set_epoch(runner.epoch) if hasattr(runner.data_loader.sampler, 'set_epoch'):
# in case the data loader uses `SequentialSampler` in Pytorch
runner.data_loader.sampler.set_epoch(runner.epoch)
if hasattr(runner.data_loader.batch_sampler.sampler, 'set_epoch'):
# batch sampler in pytorch warps a sampler as its attributes.
runner.data_loader.batch_sampler.sampler.set_epoch(runner.epoch)
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