Practical Tensorflow2 Guide: Setting Up Workspace

2nd Mar 2019

Practical Tensorflow2 Guide: Setting Up Workspace

This series is aimed to improve your knowledge in applied machine learning for creating production ready applications using tensorflow2

Prerequisites

Installation & Workspace Setup

  1. Install Docker & VSCode

  2. Let's create a directory for our project. Run the following command in a terminal and it will create folder named practical-tensorflow-2. (or create it manually)

    mkdir practical-tensorflow-2 && cd practical-tensorflow-2
    
  3. Inside our practical-tensorflow-2 folder, create dockerfile with the following content

    FROM tensorflow/tensorflow:2.0.0a0-py3-jupyter
    

Note that we are using a custom dockerfile instead of defining image in docker-compose. This is intentional and is for the possibility of additional library installation in future.

  1. Create docker-compose.yml file with following content

    version: "3.6"
    services:
        tensorflow2:
            volumes:
                - /blogs/practical-tensorflow-2-setting-up-workspace/:/tf/
            ports:
                - 8888:8888
    

    This will map our local working folder to docker image volume. So we can keep our project files in our development space and still run our notebooks using docker.

  2. Start our tensorflow2 service by running the following command on terminal

    docker-compose up
    

    This will start a container with our local folder mapped to the docker image and local port 8888 mapped to container port 8888.

    TF_NOTEBOOK_START

  3. Open a browser and navigate to http://localhost:8888 or http://127.0.0.1:8888

  4. Copy the token value from Step 5 and login

    TF_NOTEBOOK_LOGIN

Now our workspace is ready for development.