Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ssstitch opened this issue Jul 27, 2024 · 1 comment

Comments

@ssstitch
Copy link

No description provided.

@ssstitch
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant