Practical Tensorflow2 Guide: Setting Up Workspace
2nd Mar 2019
This series is aimed to improve your knowledge in applied machine learning for creating production ready applications using tensorflow2
Prerequisites
-
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.
-
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
-
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
-
Inside our
practical-tensorflow-2
folder, createdockerfile
with the following contentFROM 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.
-
Create
docker-compose.yml
file with following contentversion: "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.
-
Start our
tensorflow2
service by running the following command on terminaldocker-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.
-
Open a browser and navigate to
http://localhost:8888
orhttp://127.0.0.1:8888
-
Copy the
token
value fromStep 5
and login
Now our workspace is ready for development.