A1111 WebUI の Venv に Lama-Cleanerをインストールして容量節約

容量節約できます。 

思ってたより容量少なかったしCPUでも普通に使えます。

inpaintで消すより簡単で速い。

 

Venvをアクティブにする

source ./venv/bin/activate 


lama-cleanerをインストール

./venv/bin/pip install lama-cleaner


バージョンを戻す

./venv/bin/pip install -U transformers==4.30.2

 Werkzeug-2.3.3もかな?werkzeug-2.2.2になってる

 

起動

./venv/bin/lama-cleaner --model=lama --device=cpu --port=7870 --host=0.0.0.0
モデルが自動でダウンロードされます。200MBぐらいでした。
 

ブラウザで開くと使えます。

http://127.0.0.1:7870/ 
 

ログ

(venv) MacBook-Pro:stable-diffusion-webui-ux yuki$ ./venv/bin/pip install lama-cleaner
Collecting lama-cleaner
Downloading lama_cleaner-1.2.5-py3-none-any.whl (6.8 MB)
???????????????????????????????????????? 6.8/6.8 MB 4.5 MB/s eta 0:00:00
Requirement already satisfied: torch>=1.9.0 in ./venv/lib/python3.10/site-packages (from lama-cleaner) (2.1.2)
Requirement already satisfied: opencv-python in ./venv/lib/python3.10/site-packages (from lama-cleaner) (4.8.0.76)
Collecting flask==2.2.3 (from lama-cleaner)
Downloading Flask-2.2.3-py3-none-any.whl (101 kB)
???????????????????????????????????????? 101.8/101.8 kB 3.6 MB/s eta 0:00:00
Collecting flask-socketio (from lama-cleaner)
Downloading Flask_SocketIO-5.3.6-py3-none-any.whl (18 kB)
Collecting simple-websocket (from lama-cleaner)
Downloading simple_websocket-1.0.0-py3-none-any.whl (13 kB)
Collecting flask-cors (from lama-cleaner)
Downloading Flask_Cors-4.0.1-py2.py3-none-any.whl (14 kB)
Collecting flaskwebgui==0.3.5 (from lama-cleaner)
Downloading flaskwebgui-0.3.5-py3-none-any.whl (7.9 kB)
Requirement already satisfied: pydantic in ./venv/lib/python3.10/site-packages (from lama-cleaner) (1.10.7)
Collecting rich (from lama-cleaner)
Downloading rich-13.8.0-py3-none-any.whl (241 kB)
???????????????????????????????????????? 241.6/241.6 kB 4.2 MB/s eta 0:00:00
Collecting loguru (from lama-cleaner)
Downloading loguru-0.7.2-py3-none-any.whl (62 kB)
???????????????????????????????????????? 62.5/62.5 kB 2.3 MB/s eta 0:00:00
Requirement already satisfied: yacs in ./venv/lib/python3.10/site-packages (from lama-cleaner) (0.1.8)
Requirement already satisfied: diffusers==0.16.1 in ./venv/lib/python3.10/site-packages (from lama-cleaner) (0.16.1)
Collecting transformers==4.27.4 (from lama-cleaner)
Downloading transformers-4.27.4-py3-none-any.whl (6.8 MB)
???????????????????????????????????????? 6.8/6.8 MB 4.6 MB/s eta 0:00:00
Requirement already satisfied: gradio in ./venv/lib/python3.10/site-packages (from lama-cleaner) (3.41.2)
Requirement already satisfied: piexif==1.1.3 in ./venv/lib/python3.10/site-packages (from lama-cleaner) (1.1.3)
Requirement already satisfied: safetensors in ./venv/lib/python3.10/site-packages (from lama-cleaner) (0.4.2)
Requirement already satisfied: omegaconf in ./venv/lib/python3.10/site-packages (from lama-cleaner) (2.2.3)
Collecting controlnet-aux==0.0.3 (from lama-cleaner)
Downloading controlnet_aux-0.0.3-py3-none-any.whl (122 kB)
???????????????????????????????????????? 122.9/122.9 kB 4.4 MB/s eta 0:00:00
Collecting werkzeug==2.2.2 (from lama-cleaner)
Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
???????????????????????????????????????? 232.7/232.7 kB 4.7 MB/s eta 0:00:00
Requirement already satisfied: Pillow in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (9.5.0)
Requirement already satisfied: einops in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (0.4.1)
Requirement already satisfied: filelock in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (3.12.0)
Requirement already satisfied: huggingface-hub in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (0.14.1)
Requirement already satisfied: importlib-metadata in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (6.6.0)
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (1.26.2)
Requirement already satisfied: scikit-image in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (0.21.0)
Requirement already satisfied: scipy in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (1.10.1)
Requirement already satisfied: timm in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (0.9.2)
Requirement already satisfied: torchvision in ./venv/lib/python3.10/site-packages (from controlnet-aux==0.0.3->lama-cleaner) (0.16.2)
Requirement already satisfied: regex!=2019.12.17 in ./venv/lib/python3.10/site-packages (from diffusers==0.16.1->lama-cleaner) (2023.3.23)
Requirement already satisfied: requests in ./venv/lib/python3.10/site-packages (from diffusers==0.16.1->lama-cleaner) (2.25.1)
Requirement already satisfied: Jinja2>=3.0 in ./venv/lib/python3.10/site-packages (from flask==2.2.3->lama-cleaner) (3.1.2)
Collecting itsdangerous>=2.0 (from flask==2.2.3->lama-cleaner)
Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Requirement already satisfied: click>=8.0 in ./venv/lib/python3.10/site-packages (from flask==2.2.3->lama-cleaner) (8.1.3)
Collecting whichcraft (from flaskwebgui==0.3.5->lama-cleaner)
Downloading whichcraft-0.6.1-py2.py3-none-any.whl (5.2 kB)
Requirement already satisfied: packaging>=20.0 in ./venv/lib/python3.10/site-packages (from transformers==4.27.4->lama-cleaner) (23.1)
Requirement already satisfied: pyyaml>=5.1 in ./venv/lib/python3.10/site-packages (from transformers==4.27.4->lama-cleaner) (6.0)
Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in ./venv/lib/python3.10/site-packages (from transformers==4.27.4->lama-cleaner) (0.13.3)
Requirement already satisfied: tqdm>=4.27 in ./venv/lib/python3.10/site-packages (from transformers==4.27.4->lama-cleaner) (4.65.0)
Requirement already satisfied: MarkupSafe>=2.1.1 in ./venv/lib/python3.10/site-packages (from werkzeug==2.2.2->lama-cleaner) (2.1.2)
Requirement already satisfied: typing-extensions in ./venv/lib/python3.10/site-packages (from torch>=1.9.0->lama-cleaner) (4.9.0)
Requirement already satisfied: sympy in ./venv/lib/python3.10/site-packages (from torch>=1.9.0->lama-cleaner) (1.11.1)
Requirement already satisfied: networkx in ./venv/lib/python3.10/site-packages (from torch>=1.9.0->lama-cleaner) (3.1)
Requirement already satisfied: fsspec in ./venv/lib/python3.10/site-packages (from torch>=1.9.0->lama-cleaner) (2023.4.0)
Collecting python-socketio>=5.0.2 (from flask-socketio->lama-cleaner)
Downloading python_socketio-5.11.3-py3-none-any.whl (76 kB)
???????????????????????????????????????? 76.2/76.2 kB 2.4 MB/s eta 0:00:00
Requirement already satisfied: aiofiles<24.0,>=22.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (23.1.0)
Requirement already satisfied: altair<6.0,>=4.2.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (4.2.2)
Requirement already satisfied: fastapi in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.94.0)
Requirement already satisfied: ffmpy in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.3.0)
Requirement already satisfied: gradio-client==0.5.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.5.0)
Requirement already satisfied: httpx in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.24.1)
Requirement already satisfied: importlib-resources<7.0,>=1.3 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (6.0.1)
Requirement already satisfied: matplotlib~=3.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (3.7.1)
Requirement already satisfied: orjson~=3.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (3.8.10)
Requirement already satisfied: pandas<3.0,>=1.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (2.0.1)
Requirement already satisfied: pydub in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.25.1)
Requirement already satisfied: python-multipart in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.0.6)
Requirement already satisfied: semantic-version~=2.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (2.10.0)
Requirement already satisfied: uvicorn>=0.14.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (0.22.0)
Requirement already satisfied: websockets<12.0,>=10.0 in ./venv/lib/python3.10/site-packages (from gradio->lama-cleaner) (11.0.2)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in ./venv/lib/python3.10/site-packages (from omegaconf->lama-cleaner) (4.9.3)
Requirement already satisfied: markdown-it-py>=2.2.0 in ./venv/lib/python3.10/site-packages (from rich->lama-cleaner) (2.2.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in ./venv/lib/python3.10/site-packages (from rich->lama-cleaner) (2.15.1)
Collecting wsproto (from simple-websocket->lama-cleaner)
Downloading wsproto-1.2.0-py3-none-any.whl (24 kB)
Requirement already satisfied: entrypoints in ./venv/lib/python3.10/site-packages (from altair<6.0,>=4.2.0->gradio->lama-cleaner) (0.4)
Requirement already satisfied: jsonschema>=3.0 in ./venv/lib/python3.10/site-packages (from altair<6.0,>=4.2.0->gradio->lama-cleaner) (4.17.3)
Requirement already satisfied: toolz in ./venv/lib/python3.10/site-packages (from altair<6.0,>=4.2.0->gradio->lama-cleaner) (0.12.0)
Requirement already satisfied: mdurl~=0.1 in ./venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich->lama-cleaner) (0.1.2)
Requirement already satisfied: contourpy>=1.0.1 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (1.0.7)
Requirement already satisfied: cycler>=0.10 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (4.39.3)
Requirement already satisfied: kiwisolver>=1.0.1 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (1.4.4)
Requirement already satisfied: pyparsing>=2.3.1 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in ./venv/lib/python3.10/site-packages (from matplotlib~=3.0->gradio->lama-cleaner) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in ./venv/lib/python3.10/site-packages (from pandas<3.0,>=1.0->gradio->lama-cleaner) (2023.3)
Requirement already satisfied: tzdata>=2022.1 in ./venv/lib/python3.10/site-packages (from pandas<3.0,>=1.0->gradio->lama-cleaner) (2023.3)
Collecting bidict>=0.21.0 (from python-socketio>=5.0.2->flask-socketio->lama-cleaner)
Downloading bidict-0.23.1-py3-none-any.whl (32 kB)
Collecting python-engineio>=4.8.0 (from python-socketio>=5.0.2->flask-socketio->lama-cleaner)
Downloading python_engineio-4.9.1-py3-none-any.whl (57 kB)
???????????????????????????????????????? 57.7/57.7 kB 4.9 MB/s eta 0:00:00
Requirement already satisfied: chardet<5,>=3.0.2 in ./venv/lib/python3.10/site-packages (from requests->diffusers==0.16.1->lama-cleaner) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in ./venv/lib/python3.10/site-packages (from requests->diffusers==0.16.1->lama-cleaner) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.10/site-packages (from requests->diffusers==0.16.1->lama-cleaner) (1.26.15)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.10/site-packages (from requests->diffusers==0.16.1->lama-cleaner) (2022.12.7)
Requirement already satisfied: h11>=0.8 in ./venv/lib/python3.10/site-packages (from uvicorn>=0.14.0->gradio->lama-cleaner) (0.12.0)
Requirement already satisfied: starlette<0.27.0,>=0.26.0 in ./venv/lib/python3.10/site-packages (from fastapi->gradio->lama-cleaner) (0.26.1)
Requirement already satisfied: httpcore<0.18.0,>=0.15.0 in ./venv/lib/python3.10/site-packages (from httpx->gradio->lama-cleaner) (0.15.0)
Requirement already satisfied: sniffio in ./venv/lib/python3.10/site-packages (from httpx->gradio->lama-cleaner) (1.3.0)
Requirement already satisfied: zipp>=0.5 in ./venv/lib/python3.10/site-packages (from importlib-metadata->controlnet-aux==0.0.3->lama-cleaner) (3.15.0)
Requirement already satisfied: imageio>=2.27 in ./venv/lib/python3.10/site-packages (from scikit-image->controlnet-aux==0.0.3->lama-cleaner) (2.28.1)
Requirement already satisfied: tifffile>=2022.8.12 in ./venv/lib/python3.10/site-packages (from scikit-image->controlnet-aux==0.0.3->lama-cleaner) (2023.4.12)
Requirement already satisfied: PyWavelets>=1.1.1 in ./venv/lib/python3.10/site-packages (from scikit-image->controlnet-aux==0.0.3->lama-cleaner) (1.4.1)
Requirement already satisfied: lazy_loader>=0.2 in ./venv/lib/python3.10/site-packages (from scikit-image->controlnet-aux==0.0.3->lama-cleaner) (0.2)
Requirement already satisfied: mpmath>=0.19 in ./venv/lib/python3.10/site-packages (from sympy->torch>=1.9.0->lama-cleaner) (1.3.0)
Requirement already satisfied: anyio==3.* in ./venv/lib/python3.10/site-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio->lama-cleaner) (3.6.2)
Requirement already satisfied: attrs>=17.4.0 in ./venv/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio->lama-cleaner) (23.1.0)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in ./venv/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio->lama-cleaner) (0.19.3)
Requirement already satisfied: six>=1.5 in ./venv/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio->lama-cleaner) (1.16.0)
Installing collected packages: whichcraft, wsproto, werkzeug, loguru, itsdangerous, flaskwebgui, bidict, simple-websocket, rich, flask, transformers, python-engineio, flask-cors, python-socketio, flask-socketio, controlnet-aux, lama-cleaner
Attempting uninstall: werkzeug
Found existing installation: Werkzeug 2.3.3
Uninstalling Werkzeug-2.3.3:
Successfully uninstalled Werkzeug-2.3.3
Attempting uninstall: transformers
Found existing installation: transformers 4.30.2
Uninstalling transformers-4.30.2:
Successfully uninstalled transformers-4.30.2
Successfully installed bidict-0.23.1 controlnet-aux-0.0.3 flask-2.2.3 flask-cors-4.0.1 flask-socketio-5.3.6 flaskwebgui-0.3.5 itsdangerous-2.2.0 lama-cleaner-1.2.5 loguru-0.7.2 python-engineio-4.9.1 python-socketio-5.11.3 rich-13.8.0 simple-websocket-1.0.0 transformers-4.27.4 werkzeug-2.2.2 whichcraft-0.6.1 wsproto-1.2.0

[notice] A new release of pip is available: 23.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip
 

yuki

初めての作業で調べた事、困った時の解決方法を記録するブログ。 主なテーマは、パソコン、プログラミング、カメラ、DTM、スピリチュアル、化学物質過敏症

コメントを投稿

Please Select Embedded Mode To Show The Comment System.*