DDP sampler when test #15658
Unanswered
Hannibal046
asked this question in
DDP / multi-GPU / multi-node
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, when I define my
test_dataloader
in my lightning module like this:I know
Lightning
will help automatically equip it with aDistributedSampler
. This is totally fine when doing training. But when doing test, It has two drawbacks:DistributedSampler
will evenly distribute data across multiple GPUs. It means I would get duplicate data when testing, which is unaffordable when reporting my results, especially for publishing paper. And my solution is: I definenum_test_data
in my lighting module, and I manually truncation my test data afterall_gather
operation like this.shuffle=False
when I init my test_dataloader. So I am wondering if it is possible to set default distributed sampler for test_dataloader in DDP as some kind ofSequentially_and_UnEvenly_Distributed Datasampler
?What is the elegant solution for this? I know I can reorder the gather data by myself. Also, I could do this:
Trainer(replace_sampler_ddp=False)
, but in this case, I have to take care ofsingle_gpu
andmulti_gpu
training which is not what I want. Maybelightning
would offer a hook inLightningModule
to configure our own DDP sample like this and it would only be called when using multi-gpu:Beta Was this translation helpful? Give feedback.
All reactions