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
19.7k stars 2.01k forks source link

[BUG] CANT RUN THE DOCKER IMAGE #503

Open OmarAboRabea1 opened 8 months ago

OmarAboRabea1 commented 8 months ago

I ran this script build_docker.sh but I still have an Error when I run the docker image: docker run -p 8080:8080 --rm cwq1913/lama-cleaner:cpu-1.2.2 python3 main.py --device=cpu --port=8080 -- host 0.0.0.0

ERROR: ld.so: object '/usr/local/lib/python3.10/site-packages/skimage/_shared/../../scikit_image.libs/libgomp-d22c30c5.so.1.0.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. python3: can't open file '//main.py': [Errno 2] No such file or directory

AlmightyFrog commented 8 months ago

Not the author of the project, but the docker build for lama-cleaner already was a little outdated and now with rename to IOPaint it has not been updated yet.

Here you can see, how I use it: https://github.com/AlmightyFrog/Dockerfiles/blob/main/iopaint/Dockerfile

Feel free to copy the Dockerfile and build yourself. You also could directly use the Github Actions built image ghcr.io/almightyfrog/iopaint there. it is rebuilt weekly automatically to keep OS up to date and eventually IOPaint released versions itself, but e.g. torch version is fixed.

jryebread commented 7 months ago

@AlmightyFrog do you know if theres an option with the dockerFile to enable all plugins and models with GPU? trying to figure this out with your dockerFile there thank you for sharing since this repo's Dockerfile is outdated

AlmightyFrog commented 7 months ago

You should be pretty much just need to change the line where torch is installed for the correct version. Following the README.md i guess you just need to use instead of RUN pip3 install torch==2.1.2 torchvision --extra-index-url https://download.pytorch.org/whl/cpu something like RUN pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118 for cuda or RUN pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6 for ROCm.

Sun-ZhenXing commented 3 weeks ago

Here's my solution:

FROM cwq1913/lama-cleaner:gpu-1.2.5

RUN python3 -m pip install --upgrade pip && \
    pip3 install iopaint && \
    pip3 cache purge

CMD ["iopaint", "start", "--model=lama", "--device=cuda", "--port=8080", "--host=0.0.0.0"]

build:

docker build -t local/lama-cleaner .

docker-compose.yml:

x-default: &default
  image: local/lama-cleaner
  restart: unless-stopped
  volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
    - ./models:/root/.cache
  extra_hosts:
    - host.docker.internal:host-gateway
  deploy:
    resources:
      reservations:
        devices:
          - driver: nvidia
            device_ids: ['0']
            capabilities: [compute, utility]

services:
  lama-cleaner:
    <<: *default
    ports:
      - 8380:8080