Sanster / IOPaint

Image inpainting tool powered by SOTA AI Model. Remove any unwanted object, defect, people from your pictures or erase and replace(powered by stable diffusion) any thing on your pictures.
https://www.iopaint.com/
Apache License 2.0
17.49k stars 1.77k forks source link

[BUG] Lama-cleaner: error: torch.cuda.is_available() is False #321

Open ShmuelRonen opened 11 months ago

ShmuelRonen commented 11 months ago

Model Which model are you using? lama-cleaner: 1.2.0

Describe the bug Aftert I update Lama Cleaner I got an Error:

2023-06-07 11:09:03.954 | INFO | lama_cleaner.parse_args:parse_args:193 - Loading installer config from D:\Lama Cleaner\lama-cleaner\win_start.bat..\installer_config.json usage: lama-cleaner [-h] [--host HOST] [--port PORT] [--config-installer] [--load-installer-config] [--installer-config INSTALLER_CONFIG] [--model {lama,ldm,zits,mat,fcf,sd1.5,anything4,realisticVision1.4,cv2,manga,sd2,paint_by_example,instruct_pix2pix}] [--no-half] [--cpu-offload] [--disable-nsfw] [--sd-cpu-textencoder] [--sd-controlnet] [--sd-controlnet-method {control_v11p_sd15_canny,control_v11p_sd15_openpose,control_v11p_sd15_inpaint,control_v11f1p_sd15_depth}] [--sd-local-model-path SD_LOCAL_MODEL_PATH] [--local-files-only] [--enable-xformers] [--device {cuda,cpu,mps}] [--gui] [--no-gui-auto-close] [--gui-size GUI_SIZE GUI_SIZE] [--input INPUT] [--output-dir OUTPUT_DIR] [--model-dir MODEL_DIR] [--disable-model-switch] [--quality QUALITY] [--enable-interactive-seg] [--interactive-seg-model {vit_b,vit_l,vit_h}] [--interactive-seg-device {cuda,cpu,mps}] [--enable-remove-bg] [--enable-anime-seg] [--enable-realesrgan] [--realesrgan-device {cpu,cuda,mps}] [--realesrgan-model {realesr-general-x4v3,RealESRGAN_x4plus,RealESRGAN_x4plus_anime_6B}] [--realesrgan-no-half] [--enable-gfpgan] [--gfpgan-device {cpu,cuda,mps}] [--enable-restoreformer] [--restoreformer-device {cpu,cuda,mps}] [--enable-gif] [--install-plugins-package] lama-cleaner: error: torch.cuda.is_available() is False, please use --device cpu or check your pytorch installation Press any key to continue . . .

In CMD I got this:

Microsoft Windows [Version 10.0.19045.2965] (c) Microsoft Corporation. All rights reserved.

C:\Users\derec>python Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import torch print(torch.version) 1.12.1+cu113 print(torch.cuda.is_available()) True

ShmuelRonen commented 11 months ago

I update Cuda and Torech but the error continue

Successfully installed torch-2.0.1+cu117

C:\Users\derec\OneDrive\Desktop\Deep_Fack>python Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import torch print(torch.version) 2.0.1+cu117 print(torch.cuda.is_available()) True

2023-06-07 12:24:36.376 | INFO | lama_cleaner.parse_args:parse_args:193 - Loading installer config from D:\Lama Cleaner\lama-cleaner\win_start.bat..\installer_config.json usage: lama-cleaner [-h] [--host HOST] [--port PORT] [--config-installer] [--load-installer-config] [--installer-config INSTALLER_CONFIG] [--model {lama,ldm,zits,mat,fcf,sd1.5,anything4,realisticVision1.4,cv2,manga,sd2,paint_by_example,instruct_pix2pix}] [--no-half] [--cpu-offload] [--disable-nsfw] [--sd-cpu-textencoder] [--sd-controlnet] [--sd-controlnet-method {control_v11p_sd15_canny,control_v11p_sd15_openpose,control_v11p_sd15_inpaint,control_v11f1p_sd15_depth}] [--sd-local-model-path SD_LOCAL_MODEL_PATH] [--local-files-only] [--enable-xformers] [--device {cuda,cpu,mps}] [--gui] [--no-gui-auto-close] [--gui-size GUI_SIZE GUI_SIZE] [--input INPUT] [--output-dir OUTPUT_DIR] [--model-dir MODEL_DIR] [--disable-model-switch] [--quality QUALITY] [--enable-interactive-seg] [--interactive-seg-model {vit_b,vit_l,vit_h}] [--interactive-seg-device {cuda,cpu,mps}] [--enable-remove-bg] [--enable-anime-seg] [--enable-realesrgan] [--realesrgan-device {cpu,cuda,mps}] [--realesrgan-model {realesr-general-x4v3,RealESRGAN_x4plus,RealESRGAN_x4plus_anime_6B}] [--realesrgan-no-half] [--enable-gfpgan] [--gfpgan-device {cpu,cuda,mps}] [--enable-restoreformer] [--restoreformer-device {cpu,cuda,mps}] [--enable-gif] [--install-plugins-package] lama-cleaner: error: torch.cuda.is_available() is False, please use --device cpu or check your pytorch installation Press any key to continue . . .

Sanster commented 11 months ago

It seems that the Python environment where you installed torch 2.0.1+cu117 and launched lama-cleaner are not the same. Lama detected an environment with torch 2.0.1.

image
ShmuelRonen commented 11 months ago

This is not the main Installation it's a second one for vlad/automatic

C:\vlad\automatic>webui.bat --upgrade Using VENV: C:\vlad\automatic\venv 18:55:32-728924 INFO Starting SD.Next 18:55:32-732925 INFO Python 3.10.7 on Windows 18:55:32-813926 INFO Version: 2a664b1b Tue Jun 6 17:32:34 2023 -0400 18:55:33-384929 INFO Updating main repository 18:55:35-305927 INFO Upgraded to version: 3bef3e3e Wed Jun 7 17:25:11 2023 +0300 18:55:35-307925 INFO Setting environment tuning 18:55:35-311927 INFO nVidia CUDA toolkit detected 18:55:37-216925 INFO Torch 2.0.1+cu118 18:55:37-230925 INFO Torch backend: nVidia CUDA 11.8 cuDNN 8700 18:55:37-233925 INFO Torch detected GPU: NVIDIA GeForce RTX 3090 VRAM 24576 Arch (8, 6) Cores 82 18:55:37-235924 INFO Verifying requirements 18:55:37-247926 INFO Installing packages 18:55:37-249926 INFO Running setup 18:55:37-250933 INFO Installing repositories 18:55:41-734379 INFO Installing submodules 18:55:43-899379 INFO Updating submodules

ken456789 commented 11 months ago

after i install Xformers...i get this error too...., reinstall still get the problems...

Sanster commented 11 months ago

after i install Xformers...i get this error too...., reinstall still get the problems...

Different versions of xformers require different versions of PyTorch. Below are the tested version combinations that can be used. Perhaps it can solve your problem.

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
pip install xformers==0.0.16
ShmuelRonen commented 11 months ago

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 pip install xformers==0.0.16

In what version of Python?

Sanster commented 11 months ago

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 pip install xformers==0.0.16

In what version of Python?

python 3.10 should work