BrokenPipeError: [Errno 32] Broken pipe When i :"run cifar10_tutorial.py"

Hi @keloli!

The problem has to do with multiprocessing, DataLoader class and Windows broadly, but I’m not familiar with the details. What helped me was to set the num_workers parameter to either 0 or 1 with the data loaders.

Original (not working):

# ... code ...
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
                                          shuffle=True, num_workers=2)
# ... code ...
testloader = torch.utils.data.DataLoader(testset, batch_size=4,
                                         shuffle=False, num_workers=2)
# ... code ...

Modified (working):

# ... code ...
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
                                          shuffle=True, num_workers=0)
# ... code ...
testloader = torch.utils.data.DataLoader(testset, batch_size=4,
                                         shuffle=False, num_workers=0)
# ... code ...
13 Likes