sanghyun-son / EDSR-PyTorch

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

NameError: free variable 'device' referenced before assignment in enclosing scope #360

Open ssstitch opened 3 months ago

ssstitch commented 3 months ago

I run the main.py with --data_test Set5 --scale 4 --pre_train /home/stitch/EDSR-PyTorch-master/experiment/test/model/EDSR_x4.pt --test_only --save_results

occered this error Evaluation: 0%| | 0/5 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/stitch/EDSR-PyTorch-master/src/main.py", line 33, in main() File "/home/stitch/EDSR-PyTorch-master/src/main.py", line 26, in main while not t.terminate(): File "/home/stitch/EDSR-PyTorch-master/src/trainer.py", line 147, in terminate self.test() File "/home/stitch/EDSR-PyTorch-master/src/trainer.py", line 90, in test lr, hr = self.prepare(lr, hr) File "/home/stitch/EDSR-PyTorch-master/src/trainer.py", line 143, in prepare return [_prepare(a) for a in args] File "/home/stitch/EDSR-PyTorch-master/src/trainer.py", line 143, in return [_prepare(a) for a in args] File "/home/stitch/EDSR-PyTorch-master/src/trainer.py", line 141, in _prepare return tensor.to(device) NameError: free variable 'device' referenced before assignment in enclosing scope

what should I do,thanks