Skip to content

Commit acc6072

Browse files
committed
Display informational troubleshooting for CUDA valued users.
1 parent 2eac203 commit acc6072

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

inference_gfpgan.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,29 @@ def main():
6060
if args.bg_upsampler == 'realesrgan':
6161
if not torch.cuda.is_available(): # CPU
6262
import warnings
63+
64+
warnings.warn('Here is going to run `--bg_upsampler=realesrgan` in CPU (not CUDA) power.')
65+
66+
if torch.__version__.endswith('+cpu'):
67+
warnings.warn('This is because installed version of '
68+
'PyTorch is `%s`.' % (torch.__version__, ))
69+
warnings.warn('If you are sure to have CUDA enabled device, '
70+
'you can try to install CUDA capable PyTorch. '
71+
'Visit https://pytorch.org/get-started/locally/ '
72+
'and check START LOCALLY section.')
73+
warnings.warn('In 12 Nov 2022, this is useful to install CUDA powered PyTorch: '
74+
'pip3 install torch==1.12.1+cu116 --index-url https://download.pytorch.org/whl/cu116')
75+
warnings.warn('If you already have PyTorch installed, it needs to be uninstalled. try: '
76+
'pip3 uninstall torch')
77+
else:
78+
warnings.warn('This is because no CUDA capable device is detected.')
79+
80+
warnings.warn('To print PyTorch version by yourself, try: '
81+
'python -c "import torch; print(torch.__version__)"')
82+
83+
warnings.warn('To verify if PyTorch can detect CUDA, try: '
84+
'python -c "import torch; print(torch.cuda.is_available())"')
85+
6386
warnings.warn('The unoptimized RealESRGAN is slow on CPU. We do not use it. '
6487
'If you really want to use it, please modify the corresponding codes.')
6588
bg_upsampler = None

0 commit comments

Comments
 (0)