Update Dockerfile due to the missing of jupyter in the latest tensorflow gpu image (#625)

Add tips for CUDA 10
This commit is contained in:
DKing
2019-02-26 22:34:43 +08:00
committed by torzdf
parent 4fdb2afb01
commit cebf552dc5
4 changed files with 21 additions and 16 deletions

View File

@@ -6,9 +6,10 @@ RUN apt-get update -qq -y \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /opt/
RUN pip3 install --upgrade pip
RUN pip3 install cmake
RUN pip3 install dlib --install-option=--yes --install-option=USE_AVX_INSTRUCTIONS
RUN pip3 --no-cache-dir install -r /opt/requirements.txt && rm /opt/requirements.txt
WORKDIR "/notebooks"
CMD ["/run_jupyter.sh", "--allow-root"]
WORKDIR "/srv"
CMD ["/bin/bash"]

View File

@@ -6,6 +6,7 @@ RUN apt-get update -qq -y \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /opt/
RUN pip3 install --upgrade pip
RUN pip3 install cmake
RUN pip3 install dlib --install-option=--yes --install-option=USE_AVX_INSTRUCTIONS
RUN pip3 --no-cache-dir install -r /opt/requirements.txt && rm /opt/requirements.txt
@@ -16,5 +17,5 @@ RUN cd /usr/local/cuda/lib64 \
&& ln -s libcuda.so libcuda.so.1 \
&& ldconfig
WORKDIR "/notebooks"
CMD ["/run_jupyter.sh", "--allow-root"]
WORKDIR "/srv"
CMD ["/bin/bash"]

View File

@@ -16,5 +16,7 @@ face-recognition
# tensorflow is included within the docker image.
# If you are looking for dependencies for a manual install,
# you may want to install tensorflow-gpu==1.4.0 for CUDA 8.0 or tensorflow-gpu>=1.11.0 for CUDA 9.0
# you may want to install tensorflow-gpu==1.4.0 for CUDA 8.0,
# or 1.6.0<=tensorflow-gpu<=1.13.0 for CUDA 9.0
# or tensorflow-gpu>=1.13.1 or tf-nightly-gpu for CUDA 10.0
# NB: MTCNN will not work with tensorflow releases prior to 1.6.0

View File

@@ -13,9 +13,10 @@ from subprocess import CalledProcessError, run, PIPE, Popen
INSTALL_FAILED = False
# Revisions of tensorflow-gpu and cuda/cudnn requirements
TENSORFLOW_REQUIREMENTS = {"1.2": ["8.0", "5.1"],
"1.4": ["8.0", "6.0"],
"1.12": ["9.0", "7.2"]}
TENSORFLOW_REQUIREMENTS = {"==1.2.0": ["8.0", "5.1"],
"==1.4.0": ["8.0", "6.0"],
"==1.12.0": ["9.0", "7.2"],
">=1.13.1": ["10.0", "7.4"]}
class Environment():
@@ -221,7 +222,7 @@ class Environment():
tf_ver = key
break
if tf_ver:
tf_ver = "tensorflow-gpu=={}.0".format(tf_ver)
tf_ver = "tensorflow-gpu{}".format(tf_ver)
self.required_packages.append(tf_ver)
return
@@ -704,7 +705,7 @@ class Tips():
"docker build -t deepfakes-cpu -f Dockerfile.cpu .\n\n"
"3. Mount faceswap volume and Run it\n"
"# without GUI\n"
"docker run -p 8888:8888 \\ \n"
"docker run -tid -p 8888:8888 \\ \n"
"\t--hostname deepfakes-cpu --name deepfakes-cpu \\ \n"
"\t-v {path}:/srv \\ \n"
"\tdeepfakes-cpu\n\n"
@@ -712,7 +713,7 @@ class Tips():
"## enable local access to X11 server\n"
"xhost +local:\n"
"## create container\n"
"nvidia-docker run -p 8888:8888 \\ \n"
"nvidia-docker run -tid -p 8888:8888 \\ \n"
"\t--hostname deepfakes-cpu --name deepfakes-cpu \\ \n"
"\t-v {path}:/srv \\ \n"
"\t-v /tmp/.X11-unix:/tmp/.X11-unix \\ \n"
@@ -723,7 +724,7 @@ class Tips():
"\t-e UID=`id -u` \\ \n"
"\tdeepfakes-cpu \n\n"
"4. Open a new terminal to run faceswap.py in /srv\n"
"docker exec -it deepfakes-cpu bash".format(path=sys.path[0]))
"docker exec -it deepfakes-cpu bash".format(path=os.path.dirname(os.path.realpath(__file__))))
self.output.info("That's all you need to do with a docker. Have fun.")
def docker_cuda(self):
@@ -739,7 +740,7 @@ class Tips():
"docker build -t deepfakes-gpu -f Dockerfile.gpu .\n\n"
"5. Mount faceswap volume and Run it\n"
"# without gui \n"
"docker run -p 8888:8888 \\ \n"
"docker run -tid -p 8888:8888 \\ \n"
"\t--hostname deepfakes-gpu --name deepfakes-gpu \\ \n"
"\t-v {path}:/srv \\ \n"
"\tdeepfakes-gpu\n\n"
@@ -749,7 +750,7 @@ class Tips():
"## enable nvidia device if working under bumblebee\n"
"echo ON > /proc/acpi/bbswitch\n"
"## create container\n"
"nvidia-docker run -p 8888:8888 \\ \n"
"nvidia-docker run -tid -p 8888:8888 \\ \n"
"\t--hostname deepfakes-gpu --name deepfakes-gpu \\ \n"
"\t-v {path}:/srv \\ \n"
"\t-v /tmp/.X11-unix:/tmp/.X11-unix \\ \n"
@@ -760,7 +761,7 @@ class Tips():
"\t-e UID=`id -u` \\ \n"
"\tdeepfakes-gpu\n\n"
"6. Open a new terminal to interact with the project\n"
"docker exec deepfakes-gpu python /srv/tools.py gui\n".format(path=sys.path[0]))
"docker exec deepfakes-gpu python /srv/tools.py gui\n".format(path=os.path.dirname(os.path.realpath(__file__))))
def macos(self):
""" Output Tips for macOS"""
@@ -782,7 +783,7 @@ class Tips():
def pip(self):
""" Pip Tips """
self.output.info("1. Install PIP requirements\n"
"You may want to execute `chcp 866` in cmd line\n"
"You may want to execute `chcp 65001` in cmd line\n"
"to fix Unicode issues on Windows when installing dependencies")