Maclory / SPSR

Pytorch implementation of Structure-Preserving Super Resolution with Gradient Guidance (CVPR 2020 & TPAMI 2021)
448 stars 83 forks source link

if __name__ == '__main__':freeze_support() ..RuntimeError: DataLoader worker (pid(s) 11736) exited unexpectedly #10

Closed ABDOELSHEMY closed 4 years ago

ABDOELSHEMY commented 4 years ago

Hi @Maclory thank you for sharing your great work with us when i try to run the code in windows 10 with cpu only ( no gpu ) it give me this error

G:\Sr\SPSR-master\code> python test.py -opt options/test/test_spsr.json 20-05-16 05:13:46.962 - INFO: name: SPSR model: spsr scale: 4 device: null datasets:[ test_1:[ name: set5 mode: LR dataroot_LR: ../Set5/Set5_LR phase: test scale: 4 data_type: img ] ] path:[ root: ../release pretrain_model_G: ../experiments/pretrain_models/spsr.pth results_root: ../release\results\SPSR log: ../release\results\SPSR ] network_G:[ which_model_G: spsr_net norm_type: None mode: CNA nf: 64 nb: 23 in_nc: 3 out_nc: 3 gc: 32 group: 1 scale: 4 ] is_train: False

20-05-16 05:13:46.979 - INFO: Dataset [LRDataset - set5] is created. 20-05-16 05:13:46.980 - INFO: Number of test images in [set5]: 1 20-05-16 05:13:47.784 - INFO: Loading pretrained model for G [../experiments/pretrain_models/spsr.pth] ... 20-05-16 05:13:50.471 - INFO: Model [SPSRModel] is created. 20-05-16 05:13:50.472 - INFO: Testing [set5]... 20-05-16 05:13:51.150 - INFO: name: SPSR model: spsr scale: 4 device: null datasets:[ test_1:[ name: set5 mode: LR dataroot_LR: ../Set5/Set5_LR phase: test scale: 4 data_type: img ] ] path:[ root: ../release pretrain_model_G: ../experiments/pretrain_models/spsr.pth results_root: ../release\results\SPSR log: ../release\results\SPSR ] network_G:[ which_model_G: spsr_net norm_type: None mode: CNA nf: 64 nb: 23 in_nc: 3 out_nc: 3 gc: 32 group: 1 scale: 4 ] is_train: False

20-05-16 05:13:51.153 - INFO: Dataset [LRDataset - set5] is created. 20-05-16 05:13:51.154 - INFO: Number of test images in [set5]: 1 20-05-16 05:13:51.456 - INFO: Loading pretrained model for G [../experiments/pretrain_models/spsr.pth] ... 20-05-16 05:13:51.787 - INFO: Model [SPSRModel] is created. 20-05-16 05:13:51.787 - INFO: Testing [set5]... Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="mp_main__") File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Sr\SPSR-master\code\test.py", line 43, in for data in test_loader: File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 193, in iter__ return _DataLoaderIter(self) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 469, in init w.start() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

Traceback (most recent call last): File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 511, in _try_get_batch data = self.data_queue.get(timeout=timeout) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 105, in get raise Empty queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "test.py", line 43, in for data in test_loader: File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 576, in next idx, batch = self._get_batch() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 553, in _get_batch success, data = self._try_get_batch() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\utils\data\dataloader.py", line 519, in _try_get_batch raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str)) RuntimeError: DataLoader worker (pid(s) 11736) exited unexpectedly

how can i fix this please

Maclory commented 4 years ago

Hi, thank you for your interest in our work. We implemented our experiments with GPUs on Ubuntu 16.04 and we never encountered such problems. I guess it may be caused by the environment gap between Ubuntu and Windows.