sanghyun-son / EDSR-PyTorch

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

Reported an error when ran test model #24

Open air677 opened 6 years ago

air677 commented 6 years ago

Hi, thank you very much for sharing your code. I ran your test model(EDSR_x2 ) based on python-3.6.4, pytorch-0.3.1-post(windows, only cpu), torchvision-0.2.0. but it reported an error as follows:

Making model... Loading model from ../experiment/model/EDSR_baseline_x2.pt... Traceback (most recent call last): File "D:\02.Work\Project\x-prj\03.code\01.EDSR\EDSR-PyTorch-master\EDSR-PyTorch-master\code\main.py", line 13, in t = Trainer(my_loader, checkpoint, args) File "D:\02.Work\Project\x-prj\03.code\01.EDSR\EDSR-PyTorch-master\EDSR-PyTorch-master\code\trainer.py", line 15, in init self.model, self.loss, self.optimizer, self.scheduler = ckp.load() File "D:\02.Work\Project\x-prj\03.code\01.EDSR\EDSR-PyTorch-master\EDSR-PyTorch-master\code\utility.py", line 80, in load my_model = model().get_model(self.args) File "D:\02.Work\Project\x-prj\03.code\01.EDSR\EDSR-PyTorch-master\EDSR-PyTorch-master\code\model__init__.py", line 17, in get_model my_model.load_state_dict(torch.load(args.pre_train)) File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 267, in load return _load(f, map_location, pickle_module) File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 420, in _load result = unpickler.load() File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 389, in persistent_load data_type(size), location) File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 87, in default_restore_location result = fn(storage, location) File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 69, in _cuda_deserialize return obj.cuda(device) File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch_utils.py", line 61, in _cuda with torch.cuda.device(device): File "D:\06.ProgramData\Anaconda3\lib\site-packages\torch\cuda__init.py", line 226, in enter__ self.prev_idx = torch._C._cuda_getDevice() AttributeError: module 'torch._C' has no attribute '_cuda_getDevice'

Thanks.

sanghyun-son commented 6 years ago

Hello.

Maybe that problem happens because I saved the models with CudaTensor parameters.

I will fix it and notice to you as soon as possible.

Thanks.

air677 commented 6 years ago

OK. My preliminary debugging, error reporting is in the function of MSDataLoader(45 line, code\data__init__.py)

sanghyun-son commented 6 years ago

I heard that PyTorch@Windows has some problems when the number of worker is larger than 1.

Please try --n_threads 1 or --n_threads 0 to resolve the problem in the dataloader.

air677 commented 6 years ago

yes, I have tried. but it's still exist.

ABDOELSHEMY commented 6 years ago

{--n_threads 0} solve this error on windows for me, pytorch-0.4 cpu.