sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.42k stars 668 forks source link

Torch not compiled with CUDA enabled #44

Closed ABDOELSHEMY closed 6 years ago

ABDOELSHEMY commented 6 years ago

Hi @thstkdgus35 ,thank you for your great work in this project

Unfortunately, when i try to run python main.py --data_test Demo --scale 2 --pre_train ../experiment/model/EDSR_baseline_x2.pt --test_only --save_results

based on python 3.5, , pytorch 0.4, windows 10 it show this error

Making model... Traceback (most recent call last): File "main.py", line 15, in model = model.Model(args, checkpoint) File "G:\Sr\New folder\EDSR-PyTorch-master\code\model__init.py", line 24, in init__ self.model = module.make_model(args).to(self.device) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\modules\module.py", line 393, in to return self._apply(lambda t: t.to(device)) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\modules\module.py", line 176, in _apply module._apply(fn) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\modules\module.py", line 182, in _apply param.data = fn(param.data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\modules\module.py", line 393, in return self._apply(lambda t: t.to(device)) RuntimeError: Error attempting to use dtype torch.float32 with layout torch.strided and device type CUDA. Torch not compiled with CUDA enabled.

could you please show me how to test it in cpu only without gpu

thanks for Advice

sanghyun-son commented 6 years ago

Hello.

You can use --cpu argument to run the code without GPU supports, but I cannot guarantee the execution time.

Thank you.

ABDOELSHEMY commented 6 years ago

thank you very much for your reply when i use --cpu argument, it show another error

python main.py --data_test Demo --scale 2 --pre_train ../experiment/model/EDSR_b aseline_x2.pt --cpu --test_only --save_results

Making model... Loading model from ../experiment/model/EDSR_baseline_x2.pt

Evaluation: 0%| | 0/1 [00:00<?, ?it/s]Making model... Making model... Loading model from ../experiment/model/EDSR_baseline_x2.pt Loading model from ../experiment/model/EDSR_baseline_x2.pt

Evaluation: Making model...

0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main exitcode = _main(fd) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path run_name="mp_main") File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\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\Python35\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in while not t.terminate(): File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate Making model... 0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main exitcode = _main(fd) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path run_name="mp_main") File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code Loading model from ../experiment/model/EDSR_baseline_x2.pt self.test() File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter Loading model from ../experiment/model/EDSR_baseline_x2.pt mod_name, mod_spec, pkg_name, script_name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in while not t.terminate(): Evaluation:

Evaluation:

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate 0%| | 0/1 [00:00<?, ?it/s]for obj in iterable: Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main Traceback (most recent call last): File "", line 1, in File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main exitcode = _main(fd) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter self.test()prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path exitcode = _main(fd) run_name="__mp_main__")

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): pkg_name=pkg_name, script_name=fname) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\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\Python35\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare while not t.terminate(): File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter for obj in iterable:_fixup_main_from_path(data['init_main_from_path']) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate

    Making model...      File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path

return _MSDataLoaderIter(self)return _MSDataLoaderIter(self)

Making model...self.test() File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in init

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test

for idx_img, (lr, hr, filename, _) in enumerate(tqdm_test):        w.start()run_name="__mp_main__")  File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in __init__

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter w.start() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start for obj in iterable: pkg_name=pkg_name, script_name=fname) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter

Loading model from ../experiment/model/EDSR_baseline_x2.ptreturn _MSDataLoaderIter(self)  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code

Loading model from ../experiment/model/EDSR_baseline_x2.ptmod_name, mod_spec, pkg_name, script_name)

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in init

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in while not t.terminate(): File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate self.test() File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test

Evaluation: w.start()self._popen = self._Popen(self) for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): Evaluation:

self._popen = self._Popen(self)

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen 0%| | 0/1 [00:00<?, ?it/s] File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter 0%| | 0/1 [00:00<?, ?it/s] File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen Traceback (most recent call last): self._popen = self._Popen(self)for obj in iterable: File "", line 1, in

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen Traceback (most recent call last): exitcode = _main(fd) File "", line 1, in

return _MSDataLoaderIter(self) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main exitcode = _main(fd)return _default_context.get_context().Process._Popen(process_obj) return _default_context.get_context().Process._Popen(process_obj)

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in init prepare(preparation_data) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 115, in _main File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen return _default_context.get_context().Process._Popen(process_obj) w.start() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare

prepare(preparation_data)return Popen(process_obj) return Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start

_fixup_main_from_path(data['init_main_from_path'])  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 226, in prepare

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in init File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in init return Popen(process_obj) self._popen = self._Popen(self) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path _fixup_main_from_path(data['init_main_from_path'])

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in __init__

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path run_name="mp_main__") run_name="mp_main__")return _default_context.get_context().Process._Popen(process_obj)

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen prep_data = spawn.get_preparation_data(process_obj._name)prep_data = spawn.get_preparation_data(process_obj._name)prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 263, in run_path

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data

pkg_name=pkg_name, script_name=fname)return Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data pkg_name=pkg_name, script_name=fname)

_check_not_importing_main() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in init _check_not_importing_main()_check_not_importing_main() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main

mod_name, mod_spec, pkg_name, script_name)prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main

mod_name, mod_spec, pkg_name, script_name) is not going to be frozen to produce an executable.''')is not going to be frozen to produce an executable.''') File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data

is not going to be frozen to produce an executable.''') File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code RuntimeError File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code

RuntimeError : _check_not_importing_main() 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.

: exec(code, run_globals) 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.

exec(code, run_globals) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main : File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\main.py", line 18, in while not t.terminate(): 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.
while not t.terminate():    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.

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate self.test() File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 138, in terminate

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter self.test() File "G:\Sr\EDSR\EDSR-PyTorch-master\code\trainer.py", line 88, in test for idximg, (lr, hr, filename, ) in enumerate(tqdm_test):for obj in iterable: File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\site-packages\tqdm_tqdm.py", line 930, in iter

File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter for obj in iterable:return _MSDataLoaderIter(self) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 144, in iter

  File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in __init__

return _MSDataLoaderIter(self) File "G:\Sr\EDSR\EDSR-PyTorch-master\code\dataloader.py", line 117, in init w.start() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start w.start() self._popen = self._Popen(self) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py", line 105, in start

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen

self._popen = self._Popen(self) return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 212, in _Popen

File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py", line 313, in _Popen return Popen(process_obj) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in init return Popen(process_obj) prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py", line 34, in init

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data

prep_data = spawn.get_preparation_data(process_obj._name) _check_not_importing_main() File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 144, in get_preparation_data

  File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main

_check_not_importing_main() is not going to be frozen to produce an executable.''') File "C:\Users\ABDO\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 137, in _check_not_importing_main

RuntimeErroris not going to be frozen to produce an executable.'''):

    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.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.

thank you

sanghyun-son commented 6 years ago

Sorry, we do not support Windows officially.

Please try with --n_threads 0 or --n_threads 1 argument, but I cannot guarantee that it will work.

ABDOELSHEMY commented 6 years ago

Thanks man for helping me on this I appreciate it. i will close it now