Skip to content

Commit edb4c4c

Browse files
authored
Upgrade to TF2.5.1 (#612)
* Upgrade to TF2.5.1 bazel 3.7.2 * Fix v2.5.1 checksum * Fix wheel test - update ./scripts/ci_install.sh for new bazel version * Clean WORKSPACE * Update install.md * Fix typo
1 parent fd952d0 commit edb4c4c

File tree

6 files changed

+37
-85
lines changed

6 files changed

+37
-85
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
3.7.2

WORKSPACE

Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,39 @@
11
# This file includes external dependencies that are required to compile the
2-
# TensorFlow op. Maybe of them are specific versions used by the TensorFlow
3-
# binary used. These are extracted from TF v2.4.1, tensorflow/workspace.bzl.
2+
# TensorFlow op.
43

54
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
65

76
http_archive(
8-
name = "com_google_absl",
9-
sha256 = "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
10-
strip_prefix = "abseil-cpp-df3ea785d8c30a9503321a3d35ee7d35808f190d",
11-
urls = [
12-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
13-
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
14-
],
15-
)
16-
17-
http_archive(
18-
name = "com_google_googletest",
19-
sha256 = "ff7a82736e158c077e76188232eac77913a15dac0b22508c390ab3f88e6d6d86",
20-
strip_prefix = "googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb",
21-
urls = [
22-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
23-
"https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
24-
],
25-
)
26-
27-
http_archive(
28-
name = "com_google_protobuf",
29-
sha256 = "cfcba2df10feec52a84208693937c17a4b5df7775e1635c1e3baffc487b24c9b",
30-
strip_prefix = "protobuf-3.9.2",
31-
urls = [
32-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
33-
"https://github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
34-
],
7+
name = "qsim",
8+
sha256 = "d39b9c48866ce4d6a095093ae8059444d649e851219497af99e937a74f1e9a45",
9+
strip_prefix = "qsim-0.9.2-dev-20210317",
10+
urls = ["https://github.com/quantumlib/qsim/archive/v0.9.2-dev+20210317.zip"],
3511
)
3612

37-
# Use this zlib rule that depends on github since it is more reliable than zlib.net.
3813
http_archive(
39-
name = "zlib",
40-
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
41-
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
42-
strip_prefix = "zlib-1.2.11",
14+
name = "org_tensorflow",
15+
sha256 = "2023a377a16e5566b8981400af9e8c8e25d3367d82824ffec2b5b6b9c7dba55d",
16+
strip_prefix = "tensorflow-2.5.1",
4317
urls = [
44-
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
45-
"https://zlib.net/zlib-1.2.11.tar.gz",
18+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.5.1.zip",
4619
],
4720
)
4821

49-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
22+
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
5023

51-
protobuf_deps()
24+
workspace()
5225

53-
# com_google_protobuf depends on @bazel_skylib ??
54-
http_archive(
55-
name = "bazel_skylib",
56-
sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
57-
strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
58-
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
59-
)
26+
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
6027

61-
http_archive(
62-
name = "qsim",
63-
sha256 = "d39b9c48866ce4d6a095093ae8059444d649e851219497af99e937a74f1e9a45",
64-
strip_prefix = "qsim-0.9.2-dev-20210317",
65-
urls = ["https://github.com/quantumlib/qsim/archive/v0.9.2-dev+20210317.zip"],
66-
)
28+
workspace()
6729

68-
# Added for crosstool in tensorflow.
69-
http_archive(
70-
name = "io_bazel_rules_closure",
71-
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
72-
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
73-
urls = [
74-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
75-
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
76-
],
77-
)
30+
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
7831

79-
http_archive(
80-
name = "org_tensorflow",
81-
sha256 = "b91ec194ddf6c4a5a2f9d1db4af4daab0b187ff691e6f88142413d2c7e77a3bb",
82-
strip_prefix = "tensorflow-2.4.1",
83-
urls = [
84-
"https://github.com/tensorflow/tensorflow/archive/v2.4.1.zip",
85-
],
86-
)
32+
workspace()
8733

88-
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
34+
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
8935

90-
tf_workspace(tf_repo_name = "@org_tensorflow")
36+
workspace()
9137

9238
load("//third_party/tf:tf_configure.bzl", "tf_configure")
9339

docs/install.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ TensorFlow Quantum is supported on Python 3.6, 3.7, and 3.8 and depends directly
1717
### Requirements
1818

1919
* pip 19.0 or later (requires `manylinux2010` support)
20-
* [TensorFlow == 2.4.1](https://www.tensorflow.org/install/pip)
20+
* [TensorFlow == 2.5.1](https://www.tensorflow.org/install/pip)
2121

2222
See the [TensorFlow install guide](https://www.tensorflow.org/install/pip) to
2323
set up your Python development environment and an (optional) virtual environment.
@@ -27,7 +27,7 @@ Upgrade `pip` and install TensorFlow
2727
<!-- common_typos_disable -->
2828
<pre class="devsite-click-to-copy">
2929
<code class="devsite-terminal">pip3 install --upgrade pip</code>
30-
<code class="devsite-terminal">pip3 install tensorflow==2.4.1</code>
30+
<code class="devsite-terminal">pip3 install tensorflow==2.5.1</code>
3131
</pre>
3232
<!-- common_typos_enable -->
3333

@@ -84,21 +84,21 @@ As noted in the TensorFlow
8484
guide, the <a href="https://bazel.build/" class="external">Bazel</a>
8585
build system will be required.
8686

87-
Our latest source builds use TensorFlow 2.4.1. To ensure compatibility we use `bazel` version 3.1.0. To remove any existing version of Bazel:
87+
Our latest source builds use TensorFlow 2.5.1. To ensure compatibility we use `bazel` version 3.7.2. To remove any existing version of Bazel:
8888

8989
<!-- common_typos_disable -->
9090
<pre class="devsite-click-to-copy">
9191
<code class="devsite-terminal">sudo apt-get remove bazel</code>
9292
</pre>
9393
<!-- common_typos_enable -->
9494

95-
Download and install `bazel` version 3.1.0:
95+
Download and install `bazel` version 3.7.2:
9696

9797
<!-- common_typos_disable -->
9898
<pre class="devsite-click-to-copy">
99-
<code class="devsite-terminal">wget https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel_3.1.0-linux-x86_64.deb
99+
<code class="devsite-terminal">wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
100100
</code>
101-
<code class="devsite-terminal">sudo dpkg -i bazel_3.1.0-linux-x86_64.deb</code>
101+
<code class="devsite-terminal">sudo dpkg -i bazel_3.7.2-linux-x86_64.deb</code>
102102
</pre>
103103
<!-- common_typos_enable -->
104104

@@ -122,7 +122,7 @@ Finally, confirm installation of the correct `bazel` version:
122122
### 4. Build TensorFlow from source
123123

124124
Here we adapt instructions from the TensorFlow [build from source](https://www.tensorflow.org/install/source)
125-
guide, see the link for further details. TensorFlow Quantum is compatible with TensorFlow version&nbsp;2.4.
125+
guide, see the link for further details. TensorFlow Quantum is compatible with TensorFlow version&nbsp;2.5.
126126

127127
Download the
128128
<a href="https://github.com/tensorflow/tensorflow" class="external">TensorFlow source code</a>:
@@ -131,7 +131,7 @@ Download the
131131
<pre class="devsite-click-to-copy">
132132
<code class="devsite-terminal">git clone https://github.com/tensorflow/tensorflow.git</code>
133133
<code class="devsite-terminal">cd tensorflow</code>
134-
<code class="devsite-terminal">git checkout v2.4.1</code>
134+
<code class="devsite-terminal">git checkout v2.5.1</code>
135135
</pre>
136136

137137
Be sure the virtual environment you created in step 2 is activated. Then, install the TensorFlow dependencies:

release/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def finalize_options(self):
5757

5858
# placed as extra to not have required overwrite existing nightly installs if
5959
# they exist.
60-
EXTRA_PACKAGES = ['tensorflow == 2.4.1']
60+
EXTRA_PACKAGES = ['tensorflow == 2.5.1']
6161
CUR_VERSION = '0.6.0'
6262

6363

@@ -106,6 +106,7 @@ def has_ext_modules(self):
106106
'Programming Language :: Python :: 3.6',
107107
'Programming Language :: Python :: 3.7',
108108
'Programming Language :: Python :: 3.8',
109+
'Programming Language :: Python :: 3.9',
109110
'Topic :: Scientific/Engineering',
110111
'Topic :: Scientific/Engineering :: Artificial Intelligence',
111112
'Topic :: Scientific/Engineering :: Mathematics',

requirements.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
cirq==0.11.0
22
sympy==1.8
3+
numpy==1.19.5 # TensorFlow can detect if it was built against other versions.
34
nbconvert==5.6.1
45
nbformat==4.4.0
56
pylint==2.4.4
67
yapf==0.28.0
7-
tensorflow==2.4.1
8-
google-api-python-client==1.8.0
8+
tensorflow==2.5.1
99
# Needed for compatibility with cirq program protos.
1010
googleapis-common-protos==1.52.0
11+
google-api-core==1.21.0
12+
google-auth==1.18.0
13+
google-api-python-client==1.8.0
14+
grpcio==1.34.1
15+
protobuf==3.13.0

scripts/ci_install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
# ==============================================================================
16-
wget https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel_3.1.0-linux-x86_64.deb
17-
sudo dpkg -i bazel_3.1.0-linux-x86_64.deb
16+
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
17+
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
1818
pip install --upgrade pip setuptools wheel
1919
pip install -r requirements.txt

0 commit comments

Comments
 (0)