Skip to content

Commit cbd2d32

Browse files
committed
make optional, clone & mod PyPatchMatch, build in parallel
1 parent 33cd256 commit cbd2d32

File tree

18 files changed

+56
-1479
lines changed

18 files changed

+56
-1479
lines changed

Dockerfile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
# Must use a Cuda version 11+
2-
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-devel
3-
4-
RUN mkdir /api
5-
WORKDIR /api
6-
7-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
2+
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-devel as base
83
ENV DEBIAN_FRONTEND=noninteractive
9-
10-
# Install git and OpenCV
4+
RUN mkdir -p /root/.cache/pip
5+
COPY root-cache/pip /root/.cache/pip
6+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
117
RUN apt-get update && apt-get install -yqq git
128

13-
WORKDIR /
14-
15-
COPY root-cache/. /root/.cache
9+
FROM base AS patchmatch
10+
ARG USE_PATCHMATCH=0
11+
WORKDIR /tmp
12+
COPY scripts/patchmatch-setup.sh .
13+
RUN sh patchmatch-setup.sh
1614

17-
# Compile PyPatchMatch
18-
RUN apt-get install -yqq libopencv-dev python3-opencv
19-
WORKDIR /PyPatchMatch
20-
ADD PyPatchMatch .
21-
RUN make
15+
FROM base as output
16+
RUN mkdir /api
17+
WORKDIR /api
2218

2319
# Install python packages
2420
RUN pip3 install --upgrade pip
@@ -56,6 +52,9 @@ ENV PIPELINE=${PIPELINE}
5652

5753
# If set, it will be downloaded and converted to diffusers format, and
5854
# saved in a directory with same MODEL_ID name to be loaded by diffusers.
55+
COPY root-cache/huggingface /root/.cache/huggingface
56+
COPY root-cache/checkpoints /root/.cache/checkpoints
57+
RUN du -sh /root/.cache/*
5958
ARG CHECKPOINT_URL=""
6059
ENV CHECKPOINT_URL=${CHECKPOINT_URL}
6160
ADD download-checkpoint.py .
@@ -70,6 +69,11 @@ ADD loadModel.py .
7069
ADD download.py .
7170
RUN python3 download.py
7271

72+
# Deps for RUNNING (not building) earlier options
73+
ARG USE_PATCHMATCH=0
74+
RUN if [ "$USE_PATCHMATCH" = "1" ] ; then apt-get install -yqq python3-opencv ; fi
75+
COPY --from=patchmatch /tmp/PyPatchMatch PyPatchMatch
76+
7377
# Add your custom app code, init() and inference()
7478
ADD send.py .
7579
ADD app.py .

PyPatchMatch/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

PyPatchMatch/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

PyPatchMatch/Makefile

Lines changed: 0 additions & 54 deletions
This file was deleted.

PyPatchMatch/README.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)