Git Product home page Git Product logo

keras-cntk-docker's Introduction

keras-cntk-docker

Docker container for keras + cntk intended for nvidia-docker. Based off of Durgesh Mankekar's minimal keras/jupyter container + corresponding blog post.

This container contains CNTK, TensorFlow, and Keras. When Keras is run in the container, CNTK will be the selected backend by default. Only recommended to run on a GPU instance.

Container on Docker Hub

Usage

To set up the CUDA+container drivers from scratch on the GPU instance, run these commands:

curl -O -s https://raw.githubusercontent.com/minimaxir/keras-cntk-docker/master/deps_nvidia_docker.sh
sudo sh deps_nvidia_docker.sh

You may need to run the script again after a few days (due to a GPU update on host hardware)

To run a deep learning script in the container:

sudo docker run --runtime=nvidia run -it --rm -v $(pwd)/:/keras --name keras minimaxir/keras-cntk python3 <x>.py

Where <x> is the Python script on the host server.

To run TensorFlow on Keras in the container instead of CNTK, add a -e KERAS_BACKEND='tensorflow' flag:

sudo docker run --runtime=nvidia run -it --rm -v $(pwd)/:/keras --name keras -e KERAS_BACKEND='tensorflow' minimaxir/keras-cntk python3 <x>.py

To run a Jupyter Notebook in the container (where invoking Keras in a notebook will use the CNTK backend):

sudo docker run --runtime=nvidia -it --rm -p 8888:8888 -v $(pwd):/keras --name jupyter minimaxir/keras-cntk jupyter notebook --allow-root

Run TensorBoard and Jupyter

Running both TensorBoard and Jupyter in the same container requires starting up TensorBoard in the background, then running Jupyter in the foreground:

sudo docker run --runtime=nvidia -d --rm -p 8888:8888 -p 6006:6006 -v $(pwd):/keras --name jupyter -e KERAS_BACKEND='tensorflow' minimaxir/keras-cntk tensorboard --logdir=/keras/logs
sudo docker exec -it jupyter bash
jupyter notebook --allow-root

TensorBoard will be available on Port 6006; you'll need to use the TensorBoard callback in Keras to make results visible in TensorBoard.

Note that with this approach, killing the Jupyter console will not kill the container; you have to exit bash and run sudo docker kill jupyter.

Maintainer

Max Woolf (@minimaxir)

Max's open-source projects are supported by his Patreon. If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.

Credits

Install script deps_nvidia_docker.sh sourced from Durgesh Mankekar's blog post noted above. (reproduced here for postertity)

keras-cntk-docker's People

Contributors

minimaxir avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.