Develop TensorFlow with Jupyter Notebooks in Okteto Cloud

Image of Develop TensorFlow with Jupyter Notebooks in Okteto Cloud

Machine Learning and Data Analytics are becoming quite popular for mainstream data processing and TensorFlow notebooks are one of the leading platforms in this sector. We are happy to announce that you can now run and develop your TensorFlow programs directly in Okteto Cloud, the development platform for Kubernetes applications 😎!

What are TensorFlow notebooks? TensorFlow notebooks are Jupyter notebooks that integrate the TensorFlow library and the TensorBoard dashboard. Let me explain in a little more detail each one of these components:

  • Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text.
  • TensorFlow is an open source library, developed by Google, for dataflow and differentiable programming across a range of tasks. It is a symbolic math library, and it is also used for machine learning applications such as neural networks.
  • TensorBoard is the tool visualizing TensorFlow programs.

Deploy your TensorFlow Notebook in Okteto Cloud

Okteto Cloud is a development platform for Kubernetes applications. Sign up today to get a free developer account with 4 CPUs and 8GB of RAM. Among other handy features, it has a catalog of applications that you can directly deploy with one-click. Let’s use it to deploy your TensorFlow notebook.

Log in to Okteto Cloud and click on the Deploy button on the top left. A dialog will show you the list of available applications you can deploy. Select the tensorflow-notebook application, set the notebook password to something memorable and click the Deploy button.

Your TensorFlow notebook will be running in seconds. The Okteto Cloud UI will show you two links associated with your TensorFlow notebook instance. One is to access the Jupyter notebook and the other one is to access the TensorBoard dashboard:

Cool, no? It cannot get any simpler. No need to manage your own infra, run Docker or write Kubernetes manifests. But that’s not all, you can also improve your development workflow for TensorFlow programs using Okteto. Let’s see how it works.

Prerequisites

TensorFlow Development Environments with Okteto

We have prepared a git repository with a sample TensorFlow program to follow this tutorial. First, get a local version of the sample code by executing the following command:

1
2
$ git clone https://github.com/okteto/tensorflow-notebook-getting-started
$ cd tensorflow-notebook-getting-started

Update the PASSWORD variable in the okteto.yml file with the one you picked when deploying your TensorFlow notebook:

1
2
3
4
5
name: tensorflow-notebook
workdir: /data
command: ["jupyter", "notebook", "--allow-root"]
environment:
- PASSWORD=okteto

Run the following command to activate your TensorFlow development environment:

1
$ okteto up
1
2
3
4
5
6
7
8
9
10
11
12
 ✓  Development environment activated
✓ Files synchronized
Namespace: irespaldiza
Name: tensorflow-notebook

[I 13:54:07.261 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 13:54:07.431 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 13:54:07.442 NotebookApp] Serving notebooks from local directory: /data
[I 13:54:07.443 NotebookApp] 0 active kernels
[I 13:54:07.443 NotebookApp] The Jupyter Notebook is running at:
[I 13:54:07.443 NotebookApp] http://[all ip addresses on your system]:8888/
[I 13:54:07.443 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

The okteto up command starts a file synchronization service to keep your changes up-to-date between your local filesystem and your notebook. For example, add data sets or images to your notebook simply by storing them in your local tensorflow-notebook-getting-started folder. Okteto will make them directly available in your remote notebook. Also, whatever you edit in your Jupyter notebook will be synched back to your local filesystem.

Once you are ready with your changes, run all your cells:

And visualize the measurements and visualizations in the TensorBoard dashboard:

Finally, commit your changes when needed, no need to export/import your programs anymore 🚀!

Conclusions

Kubernetes has the potential to be a great machine learning platform, giving quick access to specialized hardware, and sharing your infrastructure by everyone in your team. Okteto simplifies your Kubernetes journey by making developers and data scientists abstract away from the low-level details. Let us know what you think about it on Twitter, or in our #okteto channel in the Kubernetes community Slack.