Error while using custom DistributedSampler
I wanted to set shuffle to False. So, i tried
sampler = torch.utils.data.distributed.DistributedSampler(dataset, shuffle=False)
dataloader = DataLoader(dataset, batch_size=32, sampler=sampler)

I am getting an error
RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.

Please anyone tell me how to use custom sampler.
Adding on to the existing answer:
DataLoader(shuffle, sampler) are mutually exclusive, i.e., if you set shuffle=True you will get a RandomSampler and if it is set to False you get a SequentialSampler.
When using DDP, Lightning takes your dataloader and replaces it with the following
DataLoader(sampler=DistributedDampler(shuffle=True), ...), however ONLY if the sampler is not already a distributed sampler. If it is, no changes are done.
So OP can do the following:
def train_dataloader(self):
    return DataLoader(sampler=DistributedSampler(shuffle=False), ...)`
returning their own sampler. Note this needs to be done in a place where the distributed group is already initialized, so basically in any hook after (including) setup(). OP got this error
RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.

Because they probably did the following:
dataloader = DataLoader(sampler=DistributedSampler(shuffle=False), ...) # fails here, because distributed not init yet
trainer = Trainer()
trainer.fit(dataloader)