sanghyun-son / EDSR-PyTorch

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

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

Open Liiiiaictx opened 8 months ago

Liiiiaictx commented 8 months ago

我用作者预训练的模型去测试,出现 (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 commented 8 months ago

看一下你是否是下载的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里面直接使用绝对路径,将你的测试集放进去