Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +89 -0
Dockerfile
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
2 |
+
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
4 |
+
|
5 |
+
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
6 |
+
|
7 |
+
RUN apt-get update && apt-get install -y unzip build-essential aria2
|
8 |
+
|
9 |
+
RUN useradd -m -u 1000 user
|
10 |
+
|
11 |
+
USER user
|
12 |
+
|
13 |
+
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH \
|
15 |
+
PYTHONPATH=$HOME/app \
|
16 |
+
PYTHONUNBUFFERED=1 \
|
17 |
+
GRADIO_ALLOW_FLAGGING=never \
|
18 |
+
GRADIO_NUM_PORTS=1 \
|
19 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
20 |
+
GRADIO_THEME=huggingface \
|
21 |
+
GRADIO_SHARE=False \
|
22 |
+
SYSTEM=spaces
|
23 |
+
|
24 |
+
# Set the working directory to the user's home directory
|
25 |
+
WORKDIR $HOME/app
|
26 |
+
|
27 |
+
# Clone your repository or add your code to the container
|
28 |
+
RUN git clone -b dev https://github.com/camenduru/PASD $HOME/app
|
29 |
+
|
30 |
+
RUN pip install -q gradio gradio_imageslider diffusers==0.21.4 accelerate basicsr ultralytics salesforce-lavis webdataset pytorch_lightning
|
31 |
+
RUN pip install -q https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl
|
32 |
+
|
33 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/akhaliq/RetinaFace-R50/resolve/main/RetinaFace-R50.pth -d $HOME/app/annotator/ckpts -o RetinaFace-R50.pth
|
34 |
+
|
35 |
+
# Define base model URL
|
36 |
+
ENV BaseModelUrl=https://huggingface.co/runwayml/stable-diffusion-v1-5
|
37 |
+
ENV BaseModelDir=$HOME/app/checkpoints/stable-diffusion-v1-5
|
38 |
+
|
39 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/model_index.json -d ${BaseModelDir} -o model_index.json
|
40 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/vae/diffusion_pytorch_model.bin -d ${BaseModelDir}/vae -o diffusion_pytorch_model.bin
|
41 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/vae/diffusion_pytorch_model.safetensors -d ${BaseModelDir}/vae -o diffusion_pytorch_model.safetensors
|
42 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/vae/config.json -d ${BaseModelDir}/vae -o config.json
|
43 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/unet/diffusion_pytorch_model.bin -d ${BaseModelDir}/unet -o diffusion_pytorch_model.bin
|
44 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/unet/diffusion_pytorch_model.safetensors -d ${BaseModelDir}/unet -o diffusion_pytorch_model.safetensors
|
45 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/unet/config.json -d ${BaseModelDir}/unet -o config.json
|
46 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/tokenizer/vocab.json -d ${BaseModelDir}/tokenizer -o vocab.json
|
47 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/tokenizer/tokenizer_config.json -d ${BaseModelDir}/tokenizer -o tokenizer_config.json
|
48 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/tokenizer/special_tokens_map.json -d ${BaseModelDir}/tokenizer -o special_tokens_map.json
|
49 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/tokenizer/merges.txt -d ${BaseModelDir}/tokenizer -o merges.txt
|
50 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/text_encoder/pytorch_model.bin -d ${BaseModelDir}/text_encoder -o pytorch_model.bin
|
51 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/text_encoder/model.safetensors -d ${BaseModelDir}/text_encoder -o model.safetensors
|
52 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/text_encoder/config.json -d ${BaseModelDir}/text_encoder -o config.json
|
53 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/scheduler/scheduler_config.json -d ${BaseModelDir}/scheduler -o scheduler_config.json
|
54 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/safety_checker/pytorch_model.bin -d ${BaseModelDir}/safety_checker -o pytorch_model.bin
|
55 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/resolve/main/safety_checker/model.safetensors -d ${BaseModelDir}/safety_checker -o model.safetensors
|
56 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/safety_checker/config.json -d ${BaseModelDir}/safety_checker -o config.json
|
57 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M ${BaseModelUrl}/raw/main/feature_extractor/preprocessor_config.json -d ${BaseModelDir}/feature_extractor -o preprocessor_config.json
|
58 |
+
|
59 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/majicmixRealistic_v6.safetensors -d $HOME/app/checkpoints/personalized_models -o majicmixRealistic_v6.safetensors
|
60 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd/checkpoint-100000/scaler.pt -d $HOME/app/runs/pasd/checkpoint-100000 -o scaler.pth
|
61 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd/checkpoint-100000/unet/config.json -d $HOME/app/runs/pasd/checkpoint-100000/unet -o config.json
|
62 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd/checkpoint-100000/unet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd/checkpoint-100000/unet -o diffusion_pytorch_model.safetensors
|
63 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd/checkpoint-100000/controlnet/config.json -d $HOME/app/runs/pasd/checkpoint-100000/controlnet -o config.json
|
64 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd/checkpoint-100000/controlnet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd/checkpoint-100000/controlnet -o diffusion_pytorch_model.safetensors
|
65 |
+
|
66 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light/checkpoint-120000/scaler.pt -d $HOME/app/runs/pasd_light/checkpoint-120000 -o scaler.pth
|
67 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_light/checkpoint-120000/unet/config.json -d $HOME/app/runs/pasd_light/checkpoint-120000/unet -o config.json
|
68 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light/checkpoint-120000/unet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_light/checkpoint-120000/unet -o diffusion_pytorch_model.safetensors
|
69 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_light/checkpoint-120000/controlnet/config.json -d $HOME/app/runs/pasd_light/checkpoint-120000/controlnet -o config.json
|
70 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light/checkpoint-120000/controlnet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_light/checkpoint-120000/controlnet -o diffusion_pytorch_model.safetensors
|
71 |
+
|
72 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light_rrdb/checkpoint-100000/scaler.pt -d $HOME/app/runs/pasd_light_rrdb/checkpoint-100000 -o scaler.pth
|
73 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_light_rrdb/checkpoint-100000/unet/config.json -d $HOME/app/runs/pasd_light_rrdb/checkpoint-100000/unet -o config.json
|
74 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light_rrdb/checkpoint-100000/unet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_light_rrdb/checkpoint-100000/unet -o diffusion_pytorch_model.safetensors
|
75 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_light_rrdb/checkpoint-100000/controlnet/config.json -d $HOME/app/runs/pasd_light_rrdb/checkpoint-100000/controlnet -o config.json
|
76 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_light_rrdb/checkpoint-100000/controlnet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_light_rrdb/checkpoint-100000/controlnet -o diffusion_pytorch_model.safetensors
|
77 |
+
|
78 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_rrdb/checkpoint-100000/scaler.pt -d $HOME/app/runs/pasd_rrdb/checkpoint-100000 -o scaler.pth
|
79 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_rrdb/checkpoint-100000/unet/config.json -d $HOME/app/runs/pasd_rrdb/checkpoint-100000/unet -o config.json
|
80 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_rrdb/checkpoint-100000/unet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_rrdb/checkpoint-100000/unet -o diffusion_pytorch_model.safetensors
|
81 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/raw/main/pasd_rrdb/checkpoint-100000/controlnet/config.json -d $HOME/app/runs/pasd_rrdb/checkpoint-100000/controlnet -o config.json
|
82 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/PASD/resolve/main/pasd_rrdb/checkpoint-100000/controlnet/diffusion_pytorch_model.safetensors -d $HOME/app/runs/pasd_rrdb/checkpoint-100000/controlnet -o diffusion_pytorch_model.safetensors
|
83 |
+
|
84 |
+
# Set the environment variable to specify the GPU device
|
85 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
86 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
87 |
+
|
88 |
+
# Run your app.py script
|
89 |
+
CMD ["python", "gradio_pasd.py"]
|