From acc60729998cf88681c3e1feb0db4a9f58d68cc6 Mon Sep 17 00:00:00 2001 From: kenjiuno Date: Sat, 12 Nov 2022 14:29:30 +0900 Subject: [PATCH] Display informational troubleshooting for CUDA valued users. --- inference_gfpgan.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/inference_gfpgan.py b/inference_gfpgan.py index 845bbad5..cb7392a6 100644 --- a/inference_gfpgan.py +++ b/inference_gfpgan.py @@ -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