I get something. I rewrote line 41 of  DistributedSampler.class 5
indices = list(torch.randperm(len(self.dataset), generator=g))

as follow:
indices = torch.randperm(len(self.dataset), generator=g).numpy().tolist()

It works for me and the memory consumption  is maintained at a certain level.