pickle data was truncated

  File "D:\SoftWare\Anaconda\envs\pytorch-1.9\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "D:\SoftWare\Anaconda\envs\pytorch-1.9\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\SoftWare\Anaconda\envs\pytorch-1.9\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "D:\SoftWare\Anaconda\envs\pytorch-1.9\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
_pickle.UnpicklingError: pickle data was truncated

把num_works改小

train_loader = torch.utils.data.DataLoader(
        train_set, batch_size=batch_size, shuffle=True,
        num_workers=num_workers, pin_memory=pin_memory,
    )

你可能感兴趣的:(pytorch,python)