forked from CompVis/latent-diffusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (26 loc) · 1.32 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM pytorch/torchserve:latest-gpu
COPY . /home/model-server/
USER root
RUN printf "\nservice_envelope=json" >> /home/model-server/config.properties
RUN printf "\ndefault_workers_per_model=1" >> /home/model-server/config.properties
RUN apt-get install -y wget
RUN if [ ! -f /home/model-server/models/ldm/text2img-large/model.ckpt ]; then \
echo "Checkpoint not found!" && \
wget -O /home/model-server/models/ldm/text2img-large/model.ckpt https://storage.googleapis.com/latentdiffusion-bucket-eu/models/ldm/text2img-large/model.ckpt ; \
fi
RUN pip install -r /home/model-server/requirements.txt
RUN pip install -e "git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers" -e "git+https://github.com/openai/CLIP.git@main#egg=clip"
RUN pip install -e /home/model-server/
USER model-server
RUN torch-model-archiver \
--model-name=latentdiffusion \
--version=1.0 \
--serialized-file /home/model-server/models/ldm/text2img-large/model.ckpt \
--handler=/home/model-server/latentdiffusion_handler.py \
--extra-files=/home/model-server/models/ldm/text2img-large/config.yaml \
--export-path=/home/model-server/model-store
CMD ["torchserve", \
"--start", \
"--ts-config=/home/model-server/config.properties", \
"--models", \
"latentdiffusion=latentdiffusion.mar"]