Google Article
My Notes on TensorFlow 2.0
února 05, 2019
Posted by Margaret Maynard-Reid, Google Developer Expert for ML

The TensorFlow 2.0 preview became available for testing in early January, and there has been a firehose of great info on the preview since then. I’m sharing my notes and useful links to help keep these all organized:
  • What is changing?
  • How to set up to try the 2.0 preview?
  • How to report bugs?
  • How to join the community?
Things are changing rapidly, so I included dates on some of the resources or issue resolutions.
Margaret's notes on TensorFlow 2.0

What is changing?

TensorFlow 2.0 is a major update focused on ease of use, with breaking changes. Here are a few key posts on tensorflow.org, Github and Medium:

TensorFlow.org

  • 9/4/2018 TensorFlow Roadmap — TF 2.0 is coming, one of the early official announcements by the TensorFlow team (more recent information is below).

GitHub

  • Effective TF 2.0 Style Guide — a summary of major changes with code snippets and before/after comparisons (this is great!).
  • TensorFlow 2.0 RFCsRFC stands for “Request for Comments”, which is a process to get community input on the proposed design revisions to the APIs. Reading through the RFCs gives a good idea of the changes and technical design discussions.

Blog posts

How to try the 2.0 preview releases

With Colab

To try the preview with a Colab notebook, just pip install TF 2.0 preview:
# Install TF 2.0 preview CPU version
$ pip install tf-nightly-2.0-preview
# Install tf 2.0 preview GPU version
$ pip install tf-nightly-gpu-2.0-preview
A GPU version of TF 2.0 for Colab became supported on 2/5/2019. To use that, include the “-gpu” prefix in your pip install commands above.

There are many API changes in TensorFlow 2.0 and the easiest way to automatically apply these changes is to run the v2 upgrade script. Note: at the moment the upgrade script only works on .py. In order to run the upgrade script on a notebook you will need to convert it to/from .py. One of my favorite issues 25448 tracks the feature that modifies the TF 2.0 upgrade script to convert .ipynb files.

Install locally

See details on how to install TensorFlow with pip on tensorflow.org. TensorFlow signed the Python 3 Statement and 2.0 will support Python 3.5 and 3.7 (tracking Issue 25429).

At the time of writing this blog post, TensorFlow 2.0 preview only works with Python 2.7 or 3.6 (not 3.7). Using a virtual environment is likely the best way to test upgrades; you can use Virtualenv or Anaconda (Note: Anaconda wasn’t working initially, but started working around 2/7/2019).

If you try to install the preview in an environment with Python version 3.7, you are going to get an error “No matching distribution found for tf-nightly-2.0-preview”:

So make sure you have Python version 2.7 or 3.6. If you have multiple Python versions in your base environment, you can specify the Python version when creating the virtual environment.
# Create a virtual environment With Virtualenv
$ virtualenv -p python3 [venv-name] 
# Activate virtual environment
$ source [venv-name]/bin/activate
After you create a virtual environment with Python 2.7 or 3.6. and activate it, you are ready to install the TF 2.0 preview.
# Install tf 2.0 preview CPU version
$ pip install tf-nightly-2.0-preview
# Install tf 2.0 preview GPU version
$ pip install tf-nightly-gpu-2.0-preview
You can use the upgrade script to update your code to be 2.0 compliant. Note the upgrade script may not update all your code. Look at the report generated and see if you need to manually handle changes. Refer to the TensorFlow 2.0 Upgrade Guide for details.
# Run upgrade script (part of TensorFlow 1.13+)
$ tf_upgrade_v2 --infile foo.py --outfile foo-upgraded.py
Deactivate the virtual environment when done.
# Deactivate virtual environment when done
$ deactivate

Install on GCP

Here is a great blog post on this topic: DeepLearning Images Revision M19. TensorFlow 2.0 experimental (link).

Report issues

Here is how to report a TensorFlow issue on GitHub during testing. Take a look at the existing issues before filing a new one:
  • TensorFlow 2.0 dashboard (link)
  • TensorFlow 2.0 open issues (link) — you can further filter the issues. For example, to see all the issues tagged with 2.0 and TFLite, set is:open label:2.0 label:comp:lite in the Filters field.
You can also communicate by using the Google groups below and the weekly testing meetings on Tuesdays, for a quick response on issues and TF 2.0 discussions.

Join the community

Here is how you can connect with the TensorFlow 2.0 test community:

Google Groups

Join these Google groups to participate in TensorFlow 2.0 testing and contribute to documentation.

Twitter

Many Googlers are working on TF 2.0 (testing) and community outreach. Here are a few of whom I follow on Twitter: Many from the community are actively testing TensorFlow 2.0, contributing and sharing their knowledge: @aureliengeron, Victor Dibia,@jerrykur, @Vikram_Tiwari, @lc0d3r… and many other ML GDEs.

Follow @tensorflow on Twitter to hear the latest news on TensorFlow 2.0!


Next post
My Notes on TensorFlow 2.0

Posted by Margaret Maynard-Reid, Google Developer Expert for ML

The TensorFlow 2.0 preview became available for testing in early January, and there has been a firehose of great info on the preview since then. I’m sharing my notes and useful links to help keep these all organized:
What is changing?How to set up to try the 2.0 preview?How to report bugs?How to join the community?Things are changing …