AttributeError: Can‘t pickle local object ‘create_torchvision_dataset_w

created at 11-22-2021 views: 1

Appears when loading the data set generated by pytorch DataLoader

AttributeError: Can‘t pickle local object ‘create_torchvision_dataset_w

The error is shown in the figure:

error screenshot

Solution

Change num_workers = 2, to num_workers = 0:

dataloader = torch.utils.data.DataLoader(
        train_dataset, batch_size=1, shuffle=True, num_workers=2, pin_memory=gpu
    )
Please log in to leave a comment.