Merge pull request #40 from bandi13/add_docker

Add Dockerfile.nvidia
This commit is contained in:
xaviviro
2023-06-17 07:30:50 +02:00
committed by GitHub
2 changed files with 33 additions and 0 deletions

20
docker/Dockerfile.nvidia Normal file
View File

@@ -0,0 +1,20 @@
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
# Always use UTC on a server
RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y python3 python3-pip python3-tk git ffmpeg nvidia-cuda-toolkit nvidia-container-runtime libnvidia-decode-525-server wget unzip
RUN wget https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip -O /tmp/buffalo_l.zip && \
mkdir -p /root/.insightface/models/buffalo_l && \
cd /root/.insightface/models/buffalo_l && \
unzip /tmp/buffalo_l.zip && \
rm -f /tmp/buffalo_l.zip
RUN pip install nvidia-tensorrt
RUN git clone https://github.com/xaviviro/refacer && cd refacer && pip install -r requirements-GPU.txt
WORKDIR /refacer
# Test following commands in container to make sure GPU stuff works
# nvidia-smi
# python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

13
docker/run.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Run this script from within the refacer/docker folder.
# You'll need inswrapper_128.onnx from either:
# https://drive.google.com/file/d/1eu60OrRtn4WhKrzM4mQv4F3rIuyUXqfl/view?usp=drive_link
# or https://drive.google.com/file/d/1jbDUGrADco9A1MutWjO6d_1dwizh9w9P/view?usp=sharing
# or https://mega.nz/file/9l8mGDJA#FnPxHwpdhDovDo6OvbQjhHd2nDAk8_iVEgo3mpHLG6U
# or https://1drv.ms/u/s!AsHA3Xbnj6uAgxhb_tmQ7egHACOR?e=CPoThO
# or https://civitai.com/models/80324?modelVersionId=85159
docker stop -t 0 refacer
docker build -t refacer -f Dockerfile.nvidia . && \
docker run --rm --name refacer -v $(pwd)/..:/refacer -p 7860:7860 --gpus all refacer python3 app.py --server_name 0.0.0.0 &
sleep 2 && google-chrome --new-window "http://127.0.0.1:7860" &