Closed devingDev closed 2 years ago
i also have a similar issue when trying to use RealESRGAN
RuntimeWarning: The unoptimized RealESRGAN is slow on CPU. We do not use it. If you really want to use it, please modify the corresponding codes.
warnings.warn('The unoptimized RealESRGAN is slow on CPU. We do not use it. '
@devingDev @geowjm Please check if PyTorch was installed correctly that is compatible with your CUDA version.
If you still cannot solve this issue, you could just comment out this judgment of if not torch.cuda.is_available():
# ------------------ set up background upsampler ------------------
if args.bg_upsampler == 'realesrgan':
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.realesrgan_utils import RealESRGANer
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=2)
bg_upsampler = RealESRGANer(
scale=2,
model_path='https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth',
model=model,
tile=args.bg_tile,
tile_pad=40,
pre_pad=0,
half=True) # need to set False in CPU mode
else:
bg_upsampler = None
in my case PyTorch was not installed correctly even though the latest version is compatible with my GPU.
I was able to force installation of the correct latest versions by running this after activating the conda env, but prior to installing packages from requirements.txt:
pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html
Using a GTX 1080 it reports cuda is available as false and uses cpu.
How can I fix this?
if __name__ == '__main__': print(f'\tCUDA?: {torch.cuda.is_available()}') device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')