From 9db0ab922f557418f6384d8e0935d287454f7070 Mon Sep 17 00:00:00 2001 From: Ivan Chernukha Date: Wed, 28 Jun 2023 19:56:28 +0000 Subject: [PATCH] feat: added simple Dockerfile to quickly run gradio app and instructions; fixed version in pip requirements.txt --- Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 13 +++++++++++++ requirements.txt | 14 +++++++++----- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b40f196 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM nvcr.io/nvidia/pytorch:23.05-py3 + +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + make \ + pkgconf \ + xz-utils \ + xorg-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libxrandr-dev \ + libxinerama-dev \ + libxcursor-dev \ + libxi-dev \ + libxxf86vm-dev + +RUN pip install --upgrade pip + +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt + +WORKDIR /workspace + +RUN (printf '#!/bin/bash\nexec \"$@\"\n' >> /entry.sh) && chmod a+x /entry.sh +ENTRYPOINT ["/entry.sh"] diff --git a/README.md b/README.md index b26a764..1d175b7 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,19 @@ cat environment.yml | \ grep -v -E 'nvidia|cuda' > environment-no-nvidia.yml && \ conda env create -f environment-no-nvidia.yml conda activate stylegan3 +``` + +## Run Gradio visualizer in Docker + +Provided docker image is based on NGC PyTorch repository. To quickly try out visualizer in Docker, run the following: + +```sh +docker build . -t draggan:latest +docker run -v "$PWD":/workspace/src -it draggan:latest bash +cd src && python visualizer_drag_gradio.py +``` +Now you can open a shared link from Gradio (printed in the terminal console). +Beware the Docker image takes about 25GB of disk space! # On MacOS export PYTORCH_ENABLE_MPS_FALLBACK=1 diff --git a/requirements.txt b/requirements.txt index e71044d..556e127 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,13 @@ -torch -torchvision -Ninja -gradio +torch>=2.0.0 +scipy==1.11.0 +Ninja==1.10.2 +gradio>=3.35.2 +imageio-ffmpeg>=0.4.3 huggingface_hub hf_transfer pyopengl imgui -glfw +glfw==2.6.1 +pillow>=9.4.0 +torchvision>=0.15.2 +imageio>=2.9.0