Skip to content

Commit

Permalink
Add gpu support for docker (deepfakes#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
DKing authored and torzdf committed Apr 21, 2018
1 parent 8004a72 commit 67009d0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
File renamed without changes.
12 changes: 12 additions & 0 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM tensorflow/tensorflow:latest-gpu-py3

RUN apt-get update -qq -y \
&& apt-get install -y cmake libsm6 libxrender1 libxext-dev python3-tk\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY requirements-docker-gpu.txt /opt/
RUN pip3 --no-cache-dir install -r /opt/requirements-docker-gpu.txt && rm /opt/requirements-docker-gpu.txt

WORKDIR "/notebooks"
CMD ["/run_jupyter.sh", "--allow-root"]
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ If there is not enough training data, start with someone who looks similar, then

#### Docker
If you prefer using Docker, You can start the project with:
- Build: `docker build -t deepfakes .`
- Run: `docker run --rm --name deepfakes -v [src_folder]:/srv -it deepfakes bash` . `bash` can be replaced by your command line
Note that the Dockerfile does not have all good requirments, so it will fail on some python 3 commands.
Also note that it does not have a GUI output, so the train.py will fail on showing image. You can comment this, or save it as a file.
- GPU:
- Prerequiste: Install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) and a CUDA driver on the host machine.
- Build: `docker build -t deepfakes-gpu -f Dockerfile.gpu .`
- Run: `nvidia-docker run --name deepfakes-gpu -p 8888:8888 -v [src_folder]:/src -it deepfakes-gpu`
- Execute: `docker exec -it deepfakes bash`
- Tested working on training.
- CPU:
- Build: `docker build -t deepfakes -f Dockerfile.cpu .`
- Run: `docker run --rm --name deepfakes -v [src_folder]:/srv -it deepfakes bash` . `bash` can be replaced by your command line
- Note that Dockerfile.cpu does not have all good requirments, so it will fail on some python 3 commands.
- Also note that it does not have a GUI output, so the train.py will fail on showing image. You can comment this, or save it as a file.

## How to contribute

Expand Down
10 changes: 10 additions & 0 deletions requirements-docker-gpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pathlib==1.0.1
scandir==1.6
h5py==2.7.1
Keras==2.1.2
opencv-python==3.3.0.10
scikit-image
dlib
face_recognition
tqdm
matplotlib

0 comments on commit 67009d0

Please sign in to comment.