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

AttributeError: module 'torch.backends' has no attribute 'mps' #355

Open
Liiiiaictx opened this issue Jan 15, 2024 · 1 comment
Open

AttributeError: module 'torch.backends' has no attribute 'mps' #355

Liiiiaictx opened this issue Jan 15, 2024 · 1 comment

Comments

@Liiiiaictx
Copy link

我用作者预训练的模型去测试,出现
(base) root@autodl-container-815011ba52-c31a7ebc:~/autodl-tmp/EDSR-PyTorch/src# python main.py --data_test Demo --scale 2 --n_resblocks 32 --n_feats 256 --res_scale 0.1 --pre_train ../experiment/model/EDSR_x2.pt --test_only --save_results
Making model...
Traceback (most recent call last):
File "main.py", line 33, in
main()
File "main.py", line 23, in main
_model = model.Model(args, checkpoint)
File "/root/autodl-tmp/EDSR-PyTorch/src/model/init.py", line 24, in init
if torch.backends.mps.is_available():
AttributeError: module 'torch.backends' has no attribute 'mps'
请问这个问题该怎么解决?

@sunmang
Copy link

sunmang commented Jan 16, 2024

看一下你是否是下载的gpu版本的torch,查看一些torch的版本和cuda的版本是否匹配.如果cuda版本过低,也可以尝试升级一些cuda版本,比如升级到11.6。如果你想测试基本集Set5,可以使用这个命令python main.py --data_test Set5 --data_range 801-900 --scale 4 --n_resblocks 32 --n_feats 256 --res_scale 0.1 --pre_train download --test_only --self_ensemble。如果你使用上述命令报错的话,基本是你测试集的位置没放对,可以在option.py里面直接使用绝对路径,将你的测试集放进去

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

2 participants