Skip to content

Commit

Permalink
Display informational troubleshooting for CUDA valued users.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjiuno committed Nov 12, 2022
1 parent 2eac203 commit acc6072
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions inference_gfpgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,29 @@ def main():
if args.bg_upsampler == 'realesrgan':
if not torch.cuda.is_available(): # CPU
import warnings

warnings.warn('Here is going to run `--bg_upsampler=realesrgan` in CPU (not CUDA) power.')

if torch.__version__.endswith('+cpu'):
warnings.warn('This is because installed version of '
'PyTorch is `%s`.' % (torch.__version__, ))
warnings.warn('If you are sure to have CUDA enabled device, '
'you can try to install CUDA capable PyTorch. '
'Visit https://pytorch.org/get-started/locally/ '
'and check START LOCALLY section.')
warnings.warn('In 12 Nov 2022, this is useful to install CUDA powered PyTorch: '
'pip3 install torch==1.12.1+cu116 --index-url https://download.pytorch.org/whl/cu116')
warnings.warn('If you already have PyTorch installed, it needs to be uninstalled. try: '
'pip3 uninstall torch')
else:
warnings.warn('This is because no CUDA capable device is detected.')

warnings.warn('To print PyTorch version by yourself, try: '
'python -c "import torch; print(torch.__version__)"')

warnings.warn('To verify if PyTorch can detect CUDA, try: '
'python -c "import torch; print(torch.cuda.is_available())"')

warnings.warn('The unoptimized RealESRGAN is slow on CPU. We do not use it. '
'If you really want to use it, please modify the corresponding codes.')
bg_upsampler = None
Expand Down

0 comments on commit acc6072

Please sign in to comment.