first commit
This commit is contained in:
53
docker/Dockerfile
Normal file
53
docker/Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
||||
FROM nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04
|
||||
|
||||
# Remove any third-party apt sources to avoid issues with expiring keys.
|
||||
RUN rm -f /etc/apt/sources.list.d/*.list
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/MADRID apt-get install -y tzdata
|
||||
|
||||
# Install some basic utilities
|
||||
RUN apt-get install -y \
|
||||
curl \
|
||||
ca-certificates \
|
||||
sudo \
|
||||
git \
|
||||
bzip2 \
|
||||
libx11-6 \
|
||||
python3 \
|
||||
python3-pip \
|
||||
libglfw3-dev \
|
||||
libgles2-mesa-dev \
|
||||
libglib2.0-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
# Create a working directory
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN cd /app
|
||||
RUN git clone https://github.com/ashawkey/stable-dreamfusion.git
|
||||
|
||||
|
||||
RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
|
||||
|
||||
WORKDIR /app/stable-dreamfusion
|
||||
|
||||
RUN pip3 install -r requirements.txt
|
||||
RUN pip3 install git+https://github.com/NVlabs/nvdiffrast/
|
||||
|
||||
# Needs nvidia runtime, if you have "No CUDA runtime is found" error: https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime, first answer
|
||||
RUN pip3 install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
|
||||
|
||||
RUN pip3 install git+https://github.com/openai/CLIP.git
|
||||
RUN bash scripts/install_ext.sh
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Set the default command to python3
|
||||
#CMD ["python3"]
|
||||
|
||||
80
docker/README.md
Normal file
80
docker/README.md
Normal file
@@ -0,0 +1,80 @@
|
||||
### Docker installation
|
||||
|
||||
## Build image
|
||||
To build the docker image on your own machine, which may take 15-30 mins:
|
||||
```
|
||||
docker build -t stable-dreamfusion:latest .
|
||||
```
|
||||
|
||||
If you have the error **No CUDA runtime is found** when building the wheels for tiny-cuda-nn you need to setup the nvidia-runtime for docker.
|
||||
```
|
||||
sudo apt-get install nvidia-container-runtime
|
||||
```
|
||||
Then edit `/etc/docker/daemon.json` and add the default-runtime:
|
||||
```
|
||||
{
|
||||
"runtimes": {
|
||||
"nvidia": {
|
||||
"path": "nvidia-container-runtime",
|
||||
"runtimeArgs": []
|
||||
}
|
||||
},
|
||||
"default-runtime": "nvidia"
|
||||
}
|
||||
```
|
||||
And restart docker:
|
||||
```
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
Now you can build tiny-cuda-nn inside docker.
|
||||
|
||||
## Download image
|
||||
To download the image (~6GB) instead:
|
||||
```
|
||||
docker pull supercabb/stable-dreamfusion:3080_0.0.1
|
||||
docker tag supercabb/stable-dreamfusion:3080_0.0.1 stable-dreamfusion
|
||||
```
|
||||
|
||||
## Use image
|
||||
|
||||
You can launch an interactive shell inside the container:
|
||||
|
||||
```
|
||||
docker run --gpus all -it --rm -v $(cd ~ && pwd):/mnt stable-dreamfusion /bin/bash
|
||||
```
|
||||
From this shell, all the code in the repo should work.
|
||||
|
||||
To run any single command `<command...>` inside the docker container:
|
||||
```
|
||||
docker run --gpus all -it --rm -v $(cd ~ && pwd):/mnt stable-dreamfusion /bin/bash -c "<command...>"
|
||||
```
|
||||
To train:
|
||||
```
|
||||
export TOKEN="#HUGGING FACE ACCESS TOKEN#"
|
||||
docker run --gpus all -it --rm -v $(cd ~ && pwd):/mnt stable-dreamfusion /bin/bash -c "echo ${TOKEN} > TOKEN \
|
||||
&& python3 main.py --text \"a hamburger\" --workspace trial -O"
|
||||
|
||||
```
|
||||
Run test without gui:
|
||||
```
|
||||
export PATH_TO_WORKSPACE="#PATH_TO_WORKSPACE#"
|
||||
docker run --gpus all -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v $(cd ~ && pwd):/mnt \
|
||||
-v $(cd ${PATH_TO_WORKSPACE} && pwd):/app/stable-dreamfusion/trial stable-dreamfusion /bin/bash -c "python3 \
|
||||
main.py --workspace trial -O --test"
|
||||
```
|
||||
Run test with gui:
|
||||
```
|
||||
export PATH_TO_WORKSPACE="#PATH_TO_WORKSPACE#"
|
||||
xhost +
|
||||
docker run --gpus all -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v $(cd ~ && pwd):/mnt \
|
||||
-v $(cd ${PATH_TO_WORKSPACE} && pwd):/app/stable-dreamfusion/trial stable-dreamfusion /bin/bash -c "python3 \
|
||||
main.py --workspace trial -O --test --gui"
|
||||
xhost -
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user