Open haideralimughal opened 1 year ago
(swin) C:\Users\lenovo\PycharmProjects\Swin-Unet_P>python train.py --dataset Synapse --cfg configs/swin_tiny_patch4_window7_224_lite.yaml --root_path C:/Users/lenovo/PycharmProjects/Swin-Unet_P/Synapse --max_epochs 15 --output_dir C:/Users/lenovo/PycharmProjects/Swin-Unet_P/resutls --img_size 224 --base_lr 0.05 --batch_size 6 => merge config from configs/swin_tiny_patch4_window7_224_lite.yaml SwinTransformerSys expand initial----depths:[2, 2, 2, 2];depths_decoder:[1, 2, 2, 2];drop_path_rate:0.2;num_classes:9 ---final upsample expand_first--- pretrained_path:./pretrained_ckpt/swin_tiny_patch4_window7_224.pth ---start load pretrained modle of swin encoder--- Namespace(accumulation_steps=None, amp_opt_level='O1', base_lr=0.0125, batch_size=6, cache_mode='part', cfg='configs/swin_tiny_patch4_window7_224_lite.yaml', dataset='Synapse', deterministic=1, eval=False, img_size=224, list_dir='./lists/lists_Synapse', max_epochs=15, max_iterations=30000, n_gpu=1, num_classes=9, opts=None, output_dir='C:/Users/lenovo/PycharmProjects/Swin-Unet_P/resutls', resume=None, root_path='C:/Users/lenovo/PycharmProjects/Swin-Unet_P/Synapse\train_npz', seed=1234, tag=None, throughput=False, use_checkpoint=False, zip=False) The length of train set is: 2211 369 iterations per epoch. 5535 max iterations 0%| | 0/15 [00:00<?, ?it/s] Traceback (most recent call last): File "train.py", line 99, in trainer[dataset_name](args, net, args.output_dir) File "C:\Users\lenovo\PycharmProjects\Swin-Unet_P\trainer.py", line 53, in trainer_synapse for i_batch, sampled_batch in enumerate(trainloader): File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 352, in iter return self._get_iterator() File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator return _MultiProcessingDataLoaderIter(self) File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 801, in init w.start() File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\popen_spawn_win32.py", line 89, in init reduction.dump(process_obj, to_child) File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'trainer_synapse..worker_init_fn'
我也碰到了这个问题,可以参照这个https://www.cnblogs.com/applerun/p/15669615.html
(swin) C:\Users\lenovo\PycharmProjects\Swin-Unet_P>python train.py --dataset Synapse --cfg configs/swin_tiny_patch4_window7_224_lite.yaml --root_path C:/Users/lenovo/PycharmProjects/Swin-Unet_P/Synapse --max_epochs 15 --output_dir C:/Users/lenovo/PycharmProjects/Swin-Unet_P/resutls --img_size 224 --base_lr 0.05 --batch_size 6 => merge config from configs/swin_tiny_patch4_window7_224_lite.yaml SwinTransformerSys expand initial----depths:[2, 2, 2, 2];depths_decoder:[1, 2, 2, 2];drop_path_rate:0.2;num_classes:9 ---final upsample expand_first--- pretrained_path:./pretrained_ckpt/swin_tiny_patch4_window7_224.pth ---start load pretrained modle of swin encoder--- Namespace(accumulation_steps=None, amp_opt_level='O1', base_lr=0.0125, batch_size=6, cache_mode='part', cfg='configs/swin_tiny_patch4_window7_224_lite.yaml', dataset='Synapse', deterministic=1, eval=False, img_size=224, list_dir='./lists/lists_Synapse', max_epochs=15, max_iterations=30000, n_gpu=1, num_classes=9, opts=None, output_dir='C:/Users/lenovo/PycharmProjects/Swin-Unet_P/resutls', resume=None, root_path='C:/Users/lenovo/PycharmProjects/Swin-Unet_P/Synapse\train_npz', seed=1234, tag=None, throughput=False, use_checkpoint=False, zip=False) The length of train set is: 2211 369 iterations per epoch. 5535 max iterations 0%| | 0/15 [00:00<?, ?it/s] Traceback (most recent call last): File "train.py", line 99, in
trainer[dataset_name](args, net, args.output_dir)
File "C:\Users\lenovo\PycharmProjects\Swin-Unet_P\trainer.py", line 53, in trainer_synapse
for i_batch, sampled_batch in enumerate(trainloader):
File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 352, in iter
return self._get_iterator()
File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "C:\Users\lenovo\anaconda3\envs\swin\lib\site-packages\torch\utils\data\dataloader.py", line 801, in init
w.start()
File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "C:\Users\lenovo\anaconda3\envs\swin\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'trainer_synapse..worker_init_fn'