pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

AttributeError: Can't pickle local object 'get_transform.<locals>.<lambda>'

Open XinJiade opened this issue 4 years ago • 4 comments

when I change the configuration of preprocess to "none" so that I can keep the size of my original picture,the problem occurs as following. Maybe the lambda in the transforms.Lambda should change.

Traceback (most recent call last): File "D:/WORKSPACE/py_temp/pytorch-CycleGAN-and-pix2pix-master/train.py", line 47, in for i, data in enumerate(dataset): # inner loop within one epoch File "D:\WORKSPACE\py_temp\pytorch-CycleGAN-and-pix2pix-master\data_init_.py", line 90, in iter for i, data in enumerate(self.dataloader): File "D:\ProgramData\Anaconda3\envs\py36_7\lib\site-packages\torch\utils\data\dataloader.py", line 279, in iter return _MultiProcessingDataLoaderIter(self) File "D:\ProgramData\Anaconda3\envs\py36_7\lib\site-packages\torch\utils\data\dataloader.py", line 719, in init w.start() File "D:\ProgramData\Anaconda3\envs\py36_7\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "D:\ProgramData\Anaconda3\envs\py36_7\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "D:\ProgramData\Anaconda3\envs\py36_7\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "D:\ProgramData\Anaconda3\envs\py36_7\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "D:\ProgramData\Anaconda3\envs\py36_7\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'get_transform..'

XinJiade avatar Nov 25 '20 08:11 XinJiade

This is due to your environment. I would suggest you try setting num_threads to 0 and reinstall some packages (follow the requirements).

JunlinHan avatar Dec 16 '20 11:12 JunlinHan

Is there any solution? I met the same problem.

KingOnTheStar avatar May 13 '21 08:05 KingOnTheStar

Thanks @JunlinHan, I’m sorry for not replying in time. For the solution , @KingOnTheStar, I had not continued to follow up on the issue later. But I think the author's suggestion might be right.

XinJiade avatar May 16 '21 06:05 XinJiade

change the "num_threads" to "0"

improgress avatar Jan 18 '22 09:01 improgress