question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not wrap existing DistributedSampler in DistributedProxySampler in auto_dataloader()

See original GitHub issue

🚀 Feature

I’ve looked at the implementation of ignite.distributed.auto_dataloader() and found that when the data loader has a sampler set, it will always wrap this sampler in a DistributedProxySampler. This works fine when the data loader sampler is of type Sampler and does itself not handle distribution of samples across processes. However, in my case I want to distribute samples differently across processes to minimize cache misses with my custom map-style dataset which buffers chunks of data. This places some constraints on how indices should be grouped based on rank, i.e., which indices should be assigned to the same process. Currently, the only work-around is to use an iterable dataset instead.

However, I would think that the lines: https://github.com/pytorch/ignite/blob/0f7819a5d2f5c17697eaf4f01848a54ed43e6e53/ignite/distributed/auto.py#L86-L89

could be changed to keep the user provided instance (of a subclass) of DistributedSampler if set.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
schuhschuhcommented, Jul 20, 2021

Ok, I’ve submitted two separate PRs. One that just raises an error in DistributedProxySampler to avoid wrapping a DistributedSampler and the other that modifies auto_dataloader() to allow users to provide their own distributed sampler.

1reaction
vfdev-5commented, Jul 20, 2021

@aschuh-hf thanks for FR and giving the context, it helps to understand !

However, I would think that the lines: … could be changed to keep the user provided instance (of a subclass) of DistributedSampler if set.

Yes, I agree that we can think about adding this possiblity to skip wraping sampler as DistributedSampler with DistributedProxySampler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature request] Let DistributedSampler take a Sampler as ...
Currently, DistributedSampler assumes that it takes a Dataset as argument. But in reality, the only information it exploits from it is its ...
Read more >
auto_dataloader — PyTorch-Ignite v0.4.10 Documentation
if a torch DistributedSampler is provided by user, it is used without wrapping it. if another sampler is provided, it is wrapped by...
Read more >
Pytorch DataLoader fails when the number of examples are ...
Long answer. Based on your code making a reduced version of your Dataloader there is no error for batch sizes. Using 9 as...
Read more >
Tutorial: Pytorch with DDL - IBM
DDL is directly integrated into the Pytorch distributed communication package, torch.distributed , as the backend ddl . This tutorial has two parts:.
Read more >
Distributed training with PyTorch | by Oleg Boiko - Medium
world_size can be obtained via torch.cuda.device_count() , assuming you'd like to utilize all available GPUs. Prepare the dataset. Let's start ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found