Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Distributed Plugin Auto Add Distributed Sampler #6535

Closed
amogkam opened this issue Mar 15, 2021 · 0 comments · Fixed by #6537
Closed

Custom Distributed Plugin Auto Add Distributed Sampler #6535

amogkam opened this issue Mar 15, 2021 · 0 comments · Fixed by #6537
Labels
bug Something isn't working help wanted Open to be worked on

Comments

@amogkam
Copy link
Contributor

amogkam commented Mar 15, 2021

🐛 Bug

I have a custom distributed plugin, but it currently does not work PTL's automatic distributed sampler.

Plugin looks like this:

class MyPlugin(ParallelPlugin):
    @property
    def distributed_sampler_kwargs(self):
        ...

But in data_loading.py, when deciding whether to add a distributed data loader, PTL looks at accelerator_connector.is_distributed:

need_dist_sampler = self.accelerator_connector.is_distributed and not isinstance(
            dataloader.sampler, DistributedSampler
        )

And self.accelerator_connector.is_distributed only returns True if the built-in plugins are used, not any custom plugin:

@property
def is_distributed(self) -> bool:
    is_distributed = self.use_ddp or self.use_ddp2 or self.use_horovod
    if self.on_tpu:
        is_distributed |= self.training_type_plugin.is_distributed
    return is_distributed

Therefore, with a custom plugin, the distributed sampler is not set.

How can a custom plugin set itself to be distributed, so this property, and any other properties related to distributed training will automatically be set to the correct value?

cc @SeanNaren @justusschock @awaelchli

@amogkam amogkam added bug Something isn't working help wanted Open to be worked on labels Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant