CodeFormer icon indicating copy to clipboard operation
CodeFormer copied to clipboard

为什么在CPU运行

Open gyy0611 opened this issue 2 years ago • 5 comments

加了--bg_upsampler realesrgan --face_upsample怎么在CPU运行的,要怎么做才可以在显卡上运行,还有图像放大可以选择倍数的不?抱脸网址上面可以选放大倍数的

gyy0611 avatar Apr 21 '23 03:04 gyy0611

提示语有,因为版本不匹配,cuda和torch的版本对不上。

执行如下命令安装指定版本的torch和cuda pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

然后在虚拟环境中输入python,进入python的cli模式,输入如下代码,检测版本修改后gpu是否可以用 import torch
torch.version torch.cuda.is_available()

Lumisa-ay avatar Jun 04 '23 04:06 Lumisa-ay

提示语有,因为版本不匹配,cuda和torch的版本对不上。

执行如下命令安装指定版本的torch和cuda pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

然后在虚拟环境中输入python,进入python的cli模式,输入如下代码,检测版本修改后gpu是否可以用 import torch torch.version torch.cuda.is_available()


我这边使用的rtx4090,然后我运行你的命令提示都是true,并且 我的其他的项目都在正确的使用cuda,但是在这个项目codeformer上一直在用的cpu运行,然后速度非常非常慢,单独处理一张图片预计5-10分钟,您能帮助分析一下吗

menkaiyuan avatar Jul 04 '23 01:07 menkaiyuan

执行这个试试,我的4060解决了: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

shadowhw avatar Dec 06 '23 13:12 shadowhw

和你同样的问题,都是True,但就是不在GPU运行。包括hf的demo https://huggingface.co/spaces/sczhou/CodeFormer/discussions/51

ucas010 avatar Jan 02 '24 06:01 ucas010

https://github.com/sczhou/CodeFormer/blob/master/web-demos/hugging_face/app.py 这个文件在哪个路径下执行呢?

ucas010 avatar Jan 02 '24 08:01 ucas010