DeblurGAN icon indicating copy to clipboard operation
DeblurGAN copied to clipboard

There is a "RuntimeError" when I use this command to run the program, my environment is windows10 64bit system.

Open dapsjj opened this issue 7 years ago • 3 comments

python test.py --dataroot E:\test_opencv\DeblurGAN-master(fangzhishoudou)\pictest\ --model test --dataset_mode single --learn_residual

There is a "RuntimeError" when I use the above command to run the program,how can I fix this error? Error message is following.

Total number of parameters: 11378179

model [TestModel] was created Traceback (most recent call last): File "", line 1, in File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 106, in spawn_main exitcode = _main(fd) File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main prepare(preparation_data) File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 226, in prepare _fixup_main_from_path(data['init_main_from_path']) File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path run_name="mp_main") File "E:\Anaconda3\lib\runpy.py", line 254, in run_path pkg_name=pkg_name, script_name=fname) File "E:\Anaconda3\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "E:\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:\test_opencv\DeblurGAN-master(fangzhishoudou)\test.py", line 31, in for i, data in enumerate(dataset): File "E:\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 310, in iter return DataLoaderIter(self) File "E:\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 167, in init w.start() File "E:\Anaconda3\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "E:\Anaconda3\lib\multiprocessing\context.py", line 212, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "E:\Anaconda3\lib\multiprocessing\context.py", line 313, in _Popen return Popen(process_obj) File "E:\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 34, in init prep_data = spawn.get_preparation_data(process_obj._name) File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 144, in get_preparation_data _check_not_importing_main() File "E:\Anaconda3\lib\multiprocessing\spawn.py", line 137, 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 "test.py", line 31, in for i, data in enumerate(dataset): File "E:\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 204, in next idx, batch = self.data_queue.get() File "E:\Anaconda3\lib\multiprocessing\queues.py", line 343, in get res = self._reader.recv_bytes() File "E:\Anaconda3\lib\multiprocessing\connection.py", line 216, in recv_bytes buf = self._recv_bytes(maxlength) File "E:\Anaconda3\lib\multiprocessing\connection.py", line 306, in _recv_bytes [ov.event], False, INFINITE) KeyboardInterrupt

dapsjj avatar Dec 11 '17 00:12 dapsjj

I met the same question.If you have solved it ,please show your solution!

ilei00 avatar Dec 17 '17 12:12 ilei00

Hello, unfortunately I am not able to test it on Windows but it seems that you have troubles with multiprocessing, try this - https://medium.com/@mackie__m/running-a-cifar-10-image-classifier-on-windows-with-pytorch-9094e29089cd

KupynOrest avatar Dec 20 '17 09:12 KupynOrest

To fix this issue the code after the imports in test.py must be the body of this if:

if __name__ == '__main__':
    <original code in test.py>

mardukbp avatar Dec 15 '20 22:12 mardukbp