-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
85 lines (73 loc) · 2.93 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=on \
SHELL=/bin/bash
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Upgrade apt packages and install required dependencies
RUN apt update && \
apt upgrade -y && \
apt install -y \
python3-dev \
python3-pip \
python3.10-venv \
fonts-dejavu-core \
rsync \
git \
git-lfs \
jq \
moreutils \
aria2 \
wget \
curl \
libglib2.0-0 \
libsm6 \
libgl1 \
libxrender1 \
libxext6 \
ffmpeg \
unzip \
libgoogle-perftools-dev \
procps && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean -y
# Set working directory
WORKDIR /workspace
# Install Torch
RUN pip3 install --no-cache-dir torch==2.4.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# Install Inswapper Serverless Worker
RUN git clone https://github.com/ashleykleynhans/runpod-worker-inswapper.git && \
cd /workspace/runpod-worker-inswapper && \
pip3 install -r requirements.txt && \
pip3 uninstall -y onnxruntime && \
pip3 install onnxruntime-gpu
# Download insightface checkpoints
RUN cd /workspace/runpod-worker-inswapper && \
mkdir -p checkpoints/models && \
cd checkpoints && \
wget -O inswapper_128.onnx https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx && \
cd models && \
wget https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip && \
mkdir buffalo_l && \
cd buffalo_l && \
unzip ../buffalo_l.zip
# Install CodeFormer
RUN cd /workspace/runpod-worker-inswapper && \
git lfs install && \
git clone https://huggingface.co/spaces/sczhou/CodeFormer
# Download CodeFormer weights
RUN cd /workspace/runpod-worker-inswapper && \
mkdir -p CodeFormer/CodeFormer/weights/CodeFormer && \
wget -O CodeFormer/CodeFormer/weights/CodeFormer/codeformer.pth "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth" && \
mkdir -p CodeFormer/CodeFormer/weights/facelib && \
wget -O CodeFormer/CodeFormer/weights/facelib/detection_Resnet50_Final.pth "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/detection_Resnet50_Final.pth" && \
wget -O CodeFormer/CodeFormer/weights/facelib/parsing_parsenet.pth "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/parsing_parsenet.pth" && \
mkdir -p CodeFormer/CodeFormer/weights/realesrgan && \
wget -O CodeFormer/CodeFormer/weights/realesrgan/RealESRGAN_x2plus.pth "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/RealESRGAN_x2plus.pth"
# Copy handler to ensure its the latest
COPY --chmod=755 rp_handler.py /workspace/runpod-worker-inswapper/rp_handler.py
# Docker container start script
COPY --chmod=755 start.sh /start.sh
# Start the container
ENTRYPOINT /start.sh