Spaces:
Running
Running
cedrus commited on
Commit ·
eecb997
1
Parent(s): a4a3859
Make GPU Docker runtime the default
Browse files- Dockerfile +17 -7
- Dockerfile.cpu +47 -0
- compose.cpu.yaml +19 -0
- compose.yaml +6 -2
- config.cpu.yaml +16 -0
- requirements-cpu.txt +27 -0
- requirements-space.txt +4 -4
- settings.py +3 -4
Dockerfile
CHANGED
|
@@ -1,13 +1,19 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PIP_NO_CACHE_DIR=1 \
|
| 6 |
-
GRADIO_ANALYTICS_ENABLED=False
|
|
|
|
|
|
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
ffmpeg \
|
| 12 |
libgl1 \
|
| 13 |
libglib2.0-0 \
|
|
@@ -17,9 +23,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 17 |
build-essential \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
COPY requirements-
|
| 21 |
RUN python -m pip install --upgrade pip \
|
| 22 |
-
&& python -m pip install -r requirements-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
COPY . .
|
| 25 |
|
|
@@ -27,9 +37,9 @@ RUN printf '%s\n' \
|
|
| 27 |
'server_name: "0.0.0.0"' \
|
| 28 |
'server_port: 7860' \
|
| 29 |
'server_share: false' \
|
| 30 |
-
'provider:
|
| 31 |
-
'force_cpu:
|
| 32 |
-
'max_threads:
|
| 33 |
'memory_limit: 0' \
|
| 34 |
'selected_theme: Default' \
|
| 35 |
'output_image_format: png' \
|
|
|
|
| 1 |
+
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PIP_NO_CACHE_DIR=1 \
|
| 6 |
+
GRADIO_ANALYTICS_ENABLED=False \
|
| 7 |
+
NVIDIA_VISIBLE_DEVICES=all \
|
| 8 |
+
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 9 |
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
python3 \
|
| 14 |
+
python3-dev \
|
| 15 |
+
python3-pip \
|
| 16 |
+
python-is-python3 \
|
| 17 |
ffmpeg \
|
| 18 |
libgl1 \
|
| 19 |
libglib2.0-0 \
|
|
|
|
| 23 |
build-essential \
|
| 24 |
&& rm -rf /var/lib/apt/lists/*
|
| 25 |
|
| 26 |
+
COPY requirements-gpu.txt .
|
| 27 |
RUN python -m pip install --upgrade pip \
|
| 28 |
+
&& python -m pip install -r requirements-gpu.txt
|
| 29 |
+
|
| 30 |
+
RUN ln -sf /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so.11.8.89 \
|
| 31 |
+
/usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so \
|
| 32 |
+
&& ldconfig
|
| 33 |
|
| 34 |
COPY . .
|
| 35 |
|
|
|
|
| 37 |
'server_name: "0.0.0.0"' \
|
| 38 |
'server_port: 7860' \
|
| 39 |
'server_share: false' \
|
| 40 |
+
'provider: cuda' \
|
| 41 |
+
'force_cpu: false' \
|
| 42 |
+
'max_threads: 1' \
|
| 43 |
'memory_limit: 0' \
|
| 44 |
'selected_theme: Default' \
|
| 45 |
'output_image_format: png' \
|
Dockerfile.cpu
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
+
PYTHONUNBUFFERED=1 \
|
| 5 |
+
PIP_NO_CACHE_DIR=1 \
|
| 6 |
+
GRADIO_ANALYTICS_ENABLED=False
|
| 7 |
+
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
+
ffmpeg \
|
| 12 |
+
libgl1 \
|
| 13 |
+
libglib2.0-0 \
|
| 14 |
+
libsm6 \
|
| 15 |
+
libxext6 \
|
| 16 |
+
libxrender1 \
|
| 17 |
+
build-essential \
|
| 18 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
COPY requirements-cpu.txt .
|
| 21 |
+
RUN python -m pip install --upgrade pip \
|
| 22 |
+
&& python -m pip install -r requirements-cpu.txt
|
| 23 |
+
|
| 24 |
+
COPY . .
|
| 25 |
+
|
| 26 |
+
RUN printf '%s\n' \
|
| 27 |
+
'server_name: "0.0.0.0"' \
|
| 28 |
+
'server_port: 7860' \
|
| 29 |
+
'server_share: false' \
|
| 30 |
+
'provider: cpu' \
|
| 31 |
+
'force_cpu: true' \
|
| 32 |
+
'max_threads: 2' \
|
| 33 |
+
'memory_limit: 0' \
|
| 34 |
+
'selected_theme: Default' \
|
| 35 |
+
'output_image_format: png' \
|
| 36 |
+
'output_video_format: mp4' \
|
| 37 |
+
'output_video_codec: libx264' \
|
| 38 |
+
'video_quality: 14' \
|
| 39 |
+
'clear_output: false' \
|
| 40 |
+
'live_cam_start_active: false' \
|
| 41 |
+
'output_template: "{file}_{time}"' \
|
| 42 |
+
'use_os_temp_folder: false' \
|
| 43 |
+
> config.yaml
|
| 44 |
+
|
| 45 |
+
EXPOSE 7860
|
| 46 |
+
|
| 47 |
+
CMD ["python", "run.py"]
|
compose.cpu.yaml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
roop-unleashed:
|
| 3 |
+
image: roop-unleashed:cpu
|
| 4 |
+
container_name: roop-unleashed
|
| 5 |
+
build:
|
| 6 |
+
context: .
|
| 7 |
+
dockerfile: Dockerfile.cpu
|
| 8 |
+
platform: linux/amd64
|
| 9 |
+
ports:
|
| 10 |
+
- "7860:7860"
|
| 11 |
+
volumes:
|
| 12 |
+
- ./output:/app/output
|
| 13 |
+
- ./models:/app/models
|
| 14 |
+
- ./models/insightface:/root/.insightface/models
|
| 15 |
+
- ./temp:/app/temp
|
| 16 |
+
- ./config.cpu.yaml:/app/config.yaml
|
| 17 |
+
command: python run.py
|
| 18 |
+
stdin_open: true
|
| 19 |
+
tty: true
|
compose.yaml
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
services:
|
| 2 |
roop-unleashed:
|
| 3 |
-
image: roop-unleashed:
|
| 4 |
container_name: roop-unleashed
|
| 5 |
build: .
|
| 6 |
platform: linux/amd64
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
ports:
|
| 8 |
- "7860:7860"
|
| 9 |
volumes:
|
|
@@ -11,7 +15,7 @@ services:
|
|
| 11 |
- ./models:/app/models
|
| 12 |
- ./models/insightface:/root/.insightface/models
|
| 13 |
- ./temp:/app/temp
|
| 14 |
-
- ./config.yaml:/app/config.yaml
|
| 15 |
command: python run.py
|
| 16 |
stdin_open: true
|
| 17 |
tty: true
|
|
|
|
| 1 |
services:
|
| 2 |
roop-unleashed:
|
| 3 |
+
image: roop-unleashed:gpu
|
| 4 |
container_name: roop-unleashed
|
| 5 |
build: .
|
| 6 |
platform: linux/amd64
|
| 7 |
+
gpus: all
|
| 8 |
+
environment:
|
| 9 |
+
NVIDIA_VISIBLE_DEVICES: all
|
| 10 |
+
NVIDIA_DRIVER_CAPABILITIES: compute,utility
|
| 11 |
ports:
|
| 12 |
- "7860:7860"
|
| 13 |
volumes:
|
|
|
|
| 15 |
- ./models:/app/models
|
| 16 |
- ./models/insightface:/root/.insightface/models
|
| 17 |
- ./temp:/app/temp
|
| 18 |
+
- ./config.gpu.yaml:/app/config.yaml
|
| 19 |
command: python run.py
|
| 20 |
stdin_open: true
|
| 21 |
tty: true
|
config.cpu.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
server_name: "0.0.0.0"
|
| 2 |
+
server_port: 7860
|
| 3 |
+
server_share: false
|
| 4 |
+
provider: cpu
|
| 5 |
+
force_cpu: true
|
| 6 |
+
max_threads: 2
|
| 7 |
+
memory_limit: 0
|
| 8 |
+
selected_theme: Default
|
| 9 |
+
output_image_format: png
|
| 10 |
+
output_video_format: mp4
|
| 11 |
+
output_video_codec: libx264
|
| 12 |
+
video_quality: 14
|
| 13 |
+
clear_output: false
|
| 14 |
+
live_cam_start_active: false
|
| 15 |
+
output_template: "{file}_{time}"
|
| 16 |
+
use_os_temp_folder: false
|
requirements-cpu.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
| 2 |
+
|
| 3 |
+
numpy==1.24.2
|
| 4 |
+
gradio==3.44.2
|
| 5 |
+
fastapi==0.103.2
|
| 6 |
+
starlette==0.27.0
|
| 7 |
+
pydantic==1.10.13
|
| 8 |
+
anyio==3.7.1
|
| 9 |
+
httpx==0.24.1
|
| 10 |
+
huggingface-hub==0.17.3
|
| 11 |
+
opencv-python==4.8.0.76
|
| 12 |
+
onnx==1.14.1
|
| 13 |
+
insightface==0.7.3
|
| 14 |
+
albumentations==1.3.1
|
| 15 |
+
opencv-python-headless==4.11.0.86
|
| 16 |
+
scikit-image==0.24.0
|
| 17 |
+
psutil==5.9.5
|
| 18 |
+
pillow==10.0.1
|
| 19 |
+
torch==2.0.1+cpu
|
| 20 |
+
torchvision==0.15.2+cpu
|
| 21 |
+
onnxruntime==1.17.3
|
| 22 |
+
protobuf==4.23.2
|
| 23 |
+
PyYAML==6.0.1
|
| 24 |
+
tqdm==4.66.1
|
| 25 |
+
ftfy
|
| 26 |
+
regex
|
| 27 |
+
pyvirtualcam
|
requirements-space.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
--extra-index-url https://download.pytorch.org/whl/
|
| 2 |
|
| 3 |
numpy==1.24.2
|
| 4 |
gradio==3.44.2
|
|
@@ -16,9 +16,9 @@ opencv-python-headless==4.11.0.86
|
|
| 16 |
scikit-image==0.24.0
|
| 17 |
psutil==5.9.5
|
| 18 |
pillow==10.0.1
|
| 19 |
-
torch==2.0.1+
|
| 20 |
-
torchvision==0.15.2+
|
| 21 |
-
onnxruntime==1.17.
|
| 22 |
protobuf==4.23.2
|
| 23 |
PyYAML==6.0.1
|
| 24 |
tqdm==4.66.1
|
|
|
|
| 1 |
+
--extra-index-url https://download.pytorch.org/whl/cu118
|
| 2 |
|
| 3 |
numpy==1.24.2
|
| 4 |
gradio==3.44.2
|
|
|
|
| 16 |
scikit-image==0.24.0
|
| 17 |
psutil==5.9.5
|
| 18 |
pillow==10.0.1
|
| 19 |
+
torch==2.0.1+cu118
|
| 20 |
+
torchvision==0.15.2+cu118
|
| 21 |
+
onnxruntime-gpu==1.17.1
|
| 22 |
protobuf==4.23.2
|
| 23 |
PyYAML==6.0.1
|
| 24 |
tqdm==4.66.1
|
settings.py
CHANGED
|
@@ -31,10 +31,10 @@ class Settings:
|
|
| 31 |
self.video_quality = self.default_get(data, 'video_quality', 14)
|
| 32 |
self.clear_output = self.default_get(data, 'clear_output', False)
|
| 33 |
self.live_cam_start_active = self.default_get(data, 'live_cam_start_active', False)
|
| 34 |
-
self.max_threads = self.default_get(data, 'max_threads',
|
| 35 |
self.memory_limit = self.default_get(data, 'memory_limit', 0)
|
| 36 |
-
self.provider = self.default_get(data, 'provider', '
|
| 37 |
-
self.force_cpu = self.default_get(data, 'force_cpu',
|
| 38 |
self.output_template = self.default_get(data, 'output_template', '{file}_{time}')
|
| 39 |
self.use_os_temp_folder = self.default_get(data, 'use_os_temp_folder', False)
|
| 40 |
|
|
@@ -64,4 +64,3 @@ class Settings:
|
|
| 64 |
with open(self.config_file, 'w') as f:
|
| 65 |
yaml.dump(data, f)
|
| 66 |
|
| 67 |
-
|
|
|
|
| 31 |
self.video_quality = self.default_get(data, 'video_quality', 14)
|
| 32 |
self.clear_output = self.default_get(data, 'clear_output', False)
|
| 33 |
self.live_cam_start_active = self.default_get(data, 'live_cam_start_active', False)
|
| 34 |
+
self.max_threads = self.default_get(data, 'max_threads', 1)
|
| 35 |
self.memory_limit = self.default_get(data, 'memory_limit', 0)
|
| 36 |
+
self.provider = self.default_get(data, 'provider', 'cuda')
|
| 37 |
+
self.force_cpu = self.default_get(data, 'force_cpu', False)
|
| 38 |
self.output_template = self.default_get(data, 'output_template', '{file}_{time}')
|
| 39 |
self.use_os_temp_folder = self.default_get(data, 'use_os_temp_folder', False)
|
| 40 |
|
|
|
|
| 64 |
with open(self.config_file, 'w') as f:
|
| 65 |
yaml.dump(data, f)
|
| 66 |
|
|
|