Practical Tensorflow2 Guide: Setting Up Workspace

02-Mar-20191 Min Read

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

Prerequisites#

  • Docker

    We are using docker image of tensorflow for quick start. Using an officially supported tensorflow docker image would help us from the troubles of configuring the development machine with all required dependencies.

  • VSCode

    Even though the majority part of this guide is using jupyter-notebook for writing our scripts/notes, it is very handy to have a code editor installed on your machine for miscellaneous code editing. We will be using VSCode for this series. However, feel free to use the code editor of your choice.

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)

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

note

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

    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

    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.