diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..21b9974 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime + +WORKDIR /app + +# Install system dependencies +ENV DEBIAN_FRONTEND=noninteractive +# RUN sed -i 's/archive.ubuntu.com/hk.archive.ubuntu.com/g' /etc/apt/sources.list +RUN apt-get update && apt-get install -y git git-lfs ffmpeg libgl1 && rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN pip install --upgrade pip setuptools wheel \ + && pip install -r requirements/requirements.txt + +ENV GRADIO_SERVER_NAME=0.0.0.0 + +EXPOSE 7860 + +CMD ["python", "app.py", "--version", "ppt-v2", "--checkpoint_dir", "checkpoints/ppt-v2", "--local_files_only" ] diff --git a/README.md b/README.md index 11fc71f..4db2359 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ PowerPaint is a high-quality versatile image inpainting model that supports text ```bash # Clone the Repository -git clone git@github.com:open-mmlab/PowerPaint.git +git clone https://github.com/davideuler/PowerPaint.git # Create Virtual Environment with Conda conda create --name ppt python=3.9 @@ -76,20 +76,21 @@ You can launch the Gradio interface for PowerPaint by running the following comm ```bash # Set up Git LFS conda install git-lfs -git lfs install +apt install git-lfs # Clone PowerPaint Model -git lfs clone https://huggingface.co/JunhaoZhuang/PowerPaint-v1/ ./checkpoints/ppt-v1 +git clone https://huggingface.co/JunhaoZhuang/PowerPaint-v1/ ./checkpoints/ppt-v1 -python app.py --share +python app.py ``` For the BrushNet-based PowerPaint, you can run the following command: ```bash # Clone PowerPaint Model -git lfs clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2 +git clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2 +ln -sf `pwd`/checkpoints/ppt-v2/realisticVisionV60B1_v51VAE/unet/diffusion_pytorch_model-002.bin checkpoints/ppt-v2/realisticVisionV60B1_v51VAE/unet/diffusion_pytorch_model.bin -python app.py --share --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2 +python app.py --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2 --local_files_only ``` ### Text-Guided Object Inpainting diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dbb6e3a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +services: + powerpaint: + build: + context: . + dockerfile: Dockerfile + image: powerpaint + command: python app.py --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2 --local_files_only + ports: + - "${MAPPED_HOST_PORT_POWERPAINT}:7860" + environment: + - GRADIO_SERVER_NAME=0.0.0.0 + volumes: + - ~/models/powerpaint/checkpoints:/app/checkpoints + - ~/.cache:/root/.cache + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] diff --git a/requirements/requirements.txt b/requirements/requirements.txt index e74317b..7b49a8f 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,9 +1,10 @@ -accelerate +accelerate==1.7.0 controlnet-aux==0.0.3 diffusers==0.27.0 -gradio==3.41.0 -mmengine +gradio==3.43.0 +mmengine==0.10.7 opencv-python -torch -torchvision +torch==2.3.1 +torchvision==0.18.1 transformers==4.28.0 +huggingface-hub==0.25.2 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..3fd8d65 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ + +(mkdir -p ~/models/powerpaint/ && cd ~/models/powerpaint/ && git clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2) + +docker-compose up -d