advimman / lama

🦙 LaMa Image Inpainting, Resolution-robust Large Mask Inpainting with Fourier Convolutions, WACV 2022
https://advimman.github.io/lama-project/
Apache License 2.0
7.99k stars 849 forks source link

did it can run with cpu, when i use cpu to run, it has some issue below. predict.py #152

Open jackieylogan opened 2 years ago

jackieylogan commented 2 years ago

i run with python3 bin/predict.py refine=True model.path=$(pwd)/big-lama indir=$(pwd)/testimage outdir=$(pwd)/output device=cpu

but i get an error: refinement.py has this line gpu_ids = [f'cuda:{gpuid}' for gpuid in gpu_ids.replace(" ","").split(",") if gpuid.isdigit()]

[2022-09-01 18:17:01,317][main][CRITICAL] - Prediction failed due to Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx: Traceback (most recent call last): File "/root/lama/bin/predict.py", line 78, in main cur_res = refine_predict(batch, model, **predict_config.refiner) File "/root/lama/saicinpainting/evaluation/refinement.py", line 318, in refine_predict image_inpainted = _infer(image, mask, forward_front, forward_rears, image_inpainted, orig_shape, devices, ids, n_iters, lr) File "/root/lama/saicinpainting/evaluation/refinement.py", line 130, in _infer mask = mask.to(devices[-1]) File "/root/inpenv/lib/python3.9/site-packages/torch/cuda/init.py", line 170, in _lazy_init torch._C._cuda_init() RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

ankuPRK commented 2 years ago

Hi @jackieylogan, the refinement process currently doesn't support running on CPU. It requires multiple forward backward passes, which would be very slow.

So you can run with python3 bin/predict.py refine=False model.path=$(pwd)/big-lama indir=$(pwd)/testimage outdir=$(pwd)/output device=cpu to run without the refinement