Sign inSign up

honghu/keras

By honghu

•Updated over 7 years ago

GPU-enabled Keras using TensorFlow/ CNTK/ MXNET/ Theano backend.

Image
8

10K+

honghu/keras repository overview

⁠DockerKeras

⁠ This project is supported by HonghuTech, a Taiwanese Deep Learning Solutions Provider

Docker Pulls GithubStars

Having trouble setting-up environments for Deep Learning? We do this for you! From now on, you shall say goodbye to annoying messages such as "Build failed..." or "An error occurred during installation...".

Currently, we maintain the following docker images:

  • Keras using TensorFlow Backened
  • Keras using CNTK Backend
  • Keras using MXNET Backend
  • Keras using Theano Backend

Apparently, all these environments support using Keras⁠ as the frontend.

See below for more details about these environments.

⁠Table of Contents

  • Before Getting Started
  • Summary of the Images
  • Keras using TensorFlow Backend
  • Keras using MXNET Backend
  • Keras using CNTK Backend
  • Keras using Theano Backend
  • ndrun - Run a Docker Container for Your Deep-Learning Research
  • Getting Started with the Command Line
    • Example: Check a Framework’s Version
    • Example: Classify Handwritten-Digits With TensorFlow

⁠Before Getting Started

  • NVIDIA-Docker2 has to be installed. See [here]⁠ for its introduction.
  • Docker needs to be configured. For example, you may have to add your user to the docker group. see [here]⁠ for Docker setup.
  • Beware: the latest images include CUDA10, which requires NVIDIA driver version >=410.XX. You can get the latest NVIDIA driver [here]⁠.

⁠Summary of the Images

The following tables list the docker images maintained by us. All these listed images are retrievable through Docker Hub⁠.

Images within the repository: honghu/keras⁠

Keras BackendImage's TagDescriptionDockerfileSuggested NV Driver
TensorFlowtf-cu10.0-dnn7.4-py3-avx2-19.01 ; tf-latestTensorFlow v1.12.0 ; Intel® Distribution for Python⁠ v2019.0-047 ; Keras v2.2.4 ; NCCL⁠ v2.3.7-1[Click]⁠R410
TensorFlowtf-cu9.2-dnn7.2-py3-avx2-18.10TensorFlow v1.11.0 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.4 ; NCCL⁠ v2.2.13[Click]⁠R396
TensorFlowtf-cu9.2-dnn7.2-py3-avx2-18.09TensorFlow v1.10.1 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.2 ; NCCL⁠ v2.2.13[Click]⁠R396
TensorFlowtf-cu9.2-dnn7.1-py3-avx2-18.08TensorFlow v1.10.0 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.2 ; NCCL⁠ v2.2.13[Click]⁠R396
TensorFlowtf-cu9-dnn7-py3-avx2-18.03TensorFlow v1.6.0 ; Keras v2.1.5[Click]⁠R384
TensorFlowtf-cu9-dnn7-py3-avx2-18.01TensorFlow v1.4.1 ; Keras v2.1.2[Click]⁠R384
MXNetmx-cu10.0-dnn7.4-py3-19.01 ; mx-latestMXNet v1.4.0.rc0 ; GluonCV⁠ v0.3.0 ; Intel® Distribution for Python⁠ v2019.0-047 ; Keras-MXNet⁠ v2.2.4.1 ; NCCL⁠ v2.3.7-1[Click]⁠R410
MXNetmx-cu9.2-dnn7.2-py3-18.10MXNet v1.3.0-dev ; GluonCV⁠ v0.3.0-dev ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras-MXNet⁠ v2.2.4.1 ; NCCL⁠ v2.2.13[Click]⁠R396
MXNetmx-cu9.2-dnn7.2-py3-18.09MXNet v1.3.0-dev ; GluonCV⁠ v0.3.0-dev ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras-MXNet⁠ v2.2.2 ; NCCL⁠ v2.2.13[Click]⁠R396
MXNetmx-cu9.2-dnn7.1-py3-18.08MXNet v1.3.0-dev ; GluonCV⁠ v0.3.0-dev ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras-MXNet⁠ v2.2.0 ; NCCL⁠ v2.2.13[Click]⁠R396
MXNetmx-cu9-dnn7-py3-18.03MXNet v1.2.0 ; Keras-MXNet⁠ v2.1.3[Click]⁠R384
MXNetmx-cu9-dnn7-py3-18.01MXNet v1.0.1 ; Keras-MXNet⁠ v1.2.2[Click]⁠R384
CNTKcntk-cu10.0-dnn7.4-py3-19.01 ; cntk-latestCNTK v2.6 ; Intel® Distribution for Python⁠ v2019.0-047 ; Keras v2.2.4 ; NCCL⁠ v2.3.7-1[Click]⁠R410
CNTKcntk-cu9.2-dnn7.2-py3-18.10CNTK v2.6 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.4 ; NCCL⁠ v2.2.13[Click]⁠R396
CNTKcntk-cu9.2-dnn7.2-py3-18.09CNTK v2.5.1 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.2[Click]⁠R396
CNTKcntk-cu9-dnn7-py3-18.08CNTK v2.5.1 ; Keras v2.2.2[Click]⁠R384
CNTKcntk-cu9-dnn7-py3-18.03CNTK v2.4 ; Keras v2.1.5[Click]⁠R384
CNTKcntk-cu8-dnn6-py3-18.01CNTK v2.2 ; Keras v2.1.2[Click]⁠
Theanotheano-cu9.0-dnn7.0-py3-18.09 ; theano-latestTheano v1.0.2 ; Intel® Distribution for Python⁠ v2018.3-039 ; Keras v2.2.2[Click]⁠R384
Theanotheano-cu9-dnn7-py3-18.03Theano v1.0.1 ; Keras v2.1.5[Click]⁠R384
Theanotheano-cu9-dnn7-py3-18.01Theano v1.0.1 ; Keras v2.1.2[Click]⁠R384

Images within the repository: honghu/intelpython3⁠

TagDescriptionDockerfile
gpu-cu10.0-dnn7.4-19.01Intel® Distribution for Python⁠ v2019.0-047 ; Ubuntu 18.04[Click]⁠
gpu-cu9.2-dnn7.2-18.09Intel® Distribution for Python⁠ v2018.3-039 ; Ubuntu 18.04[Click]⁠
gpu-cu9.0-dnn7.2-18.09Intel® Distribution for Python⁠ v2018.3-039 ; Ubuntu 16.04[Click]⁠
gpu-cu9.2-dnn7.1-18.08Intel® Distribution for Python⁠ v2018.3-039 ; Ubuntu 18.04[Click]⁠
cpu-18.09Intel® Distribution for Python⁠ v2018.3-039 ; Ubuntu 18.04[Click]⁠
cpu-18.08Intel® Distribution for Python⁠ v2018.3-039 ; Ubuntu 18.04[Click]⁠

⁠Keras using TensorFlow Backend

This environment can be obtained via:

docker pull honghu/keras:tf-cu10.0-dnn7.4-py3-avx2-19.01

which includes

  • Keras v2.2.4
  • TensorFlow v1.12.0
  • Intel® Distribution for Python⁠ v2019.0-047, including accelerated NumPy and scikit-learn.
  • NVIDIA CUDA10.0, cuDNN7.4 and NCCL2.3.7-1.
  • Must-to-have packages such as XGBOOST, Pandas, OpenCV, imgaug, Matplotlib, Seaborn and Bokeh.

⁠Keras using MXNET Backend

This environment can be obtained via:

docker pull honghu/keras:mx-cu10.0-dnn7.4-py3-19.01

which includes

  • Keras-MXNet⁠ v2.2.4.1
  • MXNet v1.4.0.rc0
  • GluonCV⁠ v0.3.0
  • Intel® Distribution for Python⁠ v2019.0-047, including accelerated NumPy and scikit-learn.
  • NVIDIA CUDA10.0, cuDNN7.4 and NCCL2.3.7-1.
  • Must-to-have packages such as XGBOOST, Pandas, OpenCV, imgaug, Matplotlib, Seaborn and Bokeh.

⁠Keras using CNTK Backend

This environment can be obtained via:

docker pull honghu/keras:cntk-cu10.0-dnn7.4-py3-19.01

which includes

  • Keras v2.2.4
  • CNTK v2.6
  • NVIDIA CUDA10.0, cuDNN7.4 and NCCL2.3.7-1.
  • Must-to-have packages such as Pandas, OpenCV, imgaug, Matplotlib, Seaborn and Bokeh.

Remark

  • According to Microsoft, CNTK backend of Keras is still in beta⁠. But, never mind! For the task such as text generation, switching the backend from TensorFlow to CNTK could possibly increase the speed of training significantly. See a [benchmark]⁠ made by Max Woolf.

⁠Keras using Theano Backend

This environment can be obtained via:

docker pull honghu/keras:theano-cu9.0-dnn7.0-py3-18.09

which includes

  • Keras v2.2.2
  • Theano v1.0.2
  • NVIDIA CUDA9.0 and cuDNN7.0.
  • Must-to-have packages such as Pandas, OpenCV, imgaug, Matplotlib, Seaborn and Bokeh.

Remark

⁠ndrun - Run a Docker Container for Your Deep-Learning Research

Before you proceed to the next section, please get ndrun first:

# Create the "bin" directory if you don't have one inside your home folder.
if [ ! -d ~/bin ] ;then
  mkdir ~/bin
fi
# Get the wrapper file and save it to "~/bin/ndrun".
wget -O ~/bin/ndrun https://raw.githubusercontent.com/chi-hung/DockerbuildsKeras/master/ndrun.sh
# Make the wrapper file executable.
chmod +x ~/bin/ndrun

ndrun is a tool that helps you to run a deep-learning environment. Before using it, please be sure to re-open your terminal in order to let the system know where this newly-added script ndrun is. In other words, make sure $HOME/bin is within your system's $PATH and then reload bash.

Remark:

  • ndrun has to be used along with the recent images (images made starting Sep. 2018). There's no garantee that it will work fine with the older images.

⁠Getting Started with the Command Line

⁠Example: Check a Framework's Version

Let's prepare a script that will import TensorFlow and print its version out:

# Create a script that prints TensorFlow's version. 
printf "import tensorflow as tf \
        \nprint('TensorFlow version=',tf.__version__)" \
        > check_tf_version.py

Now, using ndrun, the script check_tf_version.py can be executed easily using our TensorFlow image. All you have to do is add ndrun before python3 check_tf_version.py:

ndrun python3 check_tf_version.py

And you should get the following output:

TensorFlow version= 1.12.0

which indicates that the current version of TensorFlow is 1.12.0. Now, the question then arises: where is this TensorFlow installed? Indeed, the TensorFlow's version you've seen is from the TensorFlow installed inside our latest TensorFlow image.

To activate another image, we can use the option -t [IMG_TYPE]. For example, let's now prepare a script that will import CNTK and print its version out:

# Create a script that checks CNTK's version. 
printf "import cntk \
        \nprint('CNTK version=',cntk.__version__)" \
        > check_cntk_version.py

To run this script using the CNTK image, simply add the option -t cntk:

# Print CNTK's version out.
ndrun -t cntk python3 check_cntk_version.py

Its output:

CNTK version= 2.6

Currently, the possible choices of [IMG_TYPE] are:

  • tensorflow
  • cntk
  • mxnet
  • theano

Remark

  • If you select an image via its type, i.e. via [IMG_TYPE], then, the latest image of that type will be selected.
  • The latest TensorFlow image will be selected, if you do not inform ndrun which image it should select.
  • If you don't have the selected image locally, docker will pull it from Docker Hub⁠ and that might take some time.
  • You can also select an image via its tag. Type ndrun --help for more details.
⁠Example: Classify Handwritten-Digits With TensorFlow

Now, let's retrieve an example from Google's GitHub repository aimed at handwritten-digits classification. This simple model (has only one hidden layer) is written in TensorFlow and MNIST⁠ is the dataset it's using.

# Get "mnist_with_summaries.py" from Google's GitHub repository.
wget https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

Then, the retrieved script mnist_with_summaries.py can now be easily executed, via:

ndrun python3 mnist_with_summaries.py

The output should be similar to the following:

...
Extracting /tmp/tensorflow/mnist/input_data/train-labels-idx1-ubyte.gz
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Extracting /tmp/tensorflow/mnist/input_data/t10k-images-idx3-ubyte.gz
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting /tmp/tensorflow/mnist/input_data/t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From /opt/intel/intelpython3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
2019-01-09 16:41:24.505114: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: TITAN V major: 7 minor: 0 memoryClockRate(GHz): 1.455
pciBusID: 0000:04:00.0
totalMemory: 11.75GiB freeMemory: 11.34GiB
2019-01-09 16:41:24.505174: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-09 16:41:25.018713: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-09 16:41:25.018764: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2019-01-09 16:41:25.018771: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2019-01-09 16:41:25.019071: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10957 MB memory) -> physical GPU (device: 0, name: TITAN V, pci bus id: 0000:04:00.0, compute capability: 7.0)
Accuracy at step 0: 0.0867
Accuracy at step 10: 0.7258
Accuracy at step 20: 0.8332
Accuracy at step 30: 0.8655
...

Tag summary

Content type

Image

Digest

Size

4.7 GB

Last updated

over 7 years ago

docker pull honghu/keras:tf-latest