It freezes hangs right at the beginning. Seems to be something to do with the multiprocessing/queues.py. I have already read some other posts and tried:


Not using GPU


“from torch.utils.data.dataloader import DataLoader” and “from torch.utils.dataimport DataLoader”


setting  pin_memory=False


adding


if __name__ == "__main__"



running in Administrator mode


reinstalling pytorch
python3.7 on Windows 10, latest stable pyTorch build 1.2


from torch.utils.data.dataset import Dataset
from torch.utils.data import DataLoader

class DriveData(Dataset):

    def __init__(self):
        self.data = [1, 2, 3, 4, 5, 6]

    # Override to give PyTorch access to any image on the dataset
    def __getitem__(self, index):
        return self.data[index]

    # Override to give PyTorch size of dataset
    def __len__(self):
        return len(self.data)


def main():
    dset_train = DriveData()
    train_loader = DataLoader(dset_train, batch_size=2, shuffle=True, num_workers=1)

    for i, data in enumerate(train_loader):
        print(i)
        print(data)

if __name__ == "__main__":
    main()

Output when num_workers is 0:
0
tensor([2, 6])
1
tensor([1, 4])
2
tensor([5, 3])

No output when num_workers is >0. Just hangs.