Skip to content

Commit f94d2b6

Browse files
psamanoeltonmhucka
andauthored
TF2.16 support: hermetic python shim, TF 2.16.2 pin, legacy Keras path, setup/packaging fixes (#913)
Co-authored-by: Michael Hucka <mhucka@google.com>
1 parent 65ec707 commit f94d2b6

File tree

20 files changed

+872
-319
lines changed

20 files changed

+872
-319
lines changed

.gitignore

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# ============================================================================
15+
1516
*.pickle
16-
*.txt
1717
*.bak
1818

19-
# ignore compiled python files
19+
# Ignore compiled Python files and wheels.
2020
*.pyc
21+
*.whl
2122

2223
# ignore idea SDK
2324
.idea/*
@@ -27,23 +28,30 @@
2728
*__pycache__/*
2829
*.cache/*
2930
*.ipynb_checkpoints*
31+
.ipynb_checkpoints
3032

3133
# Mac only
3234
.DS_Store
3335

3436
# Ignore testing trash
3537
*.qmod
3638

37-
# Bazel files
38-
/bazel-*
39-
# custom bazelrc for the TF op, created in configure.sh
39+
# Files generated by configure.sh
4040
.bazelrc
41+
.bazelrc.user
42+
.tf_configure.bazelrc
43+
third_party/python_legacy
44+
45+
# Bazel directories & files created at run time.
46+
/bazel-*
4147

4248
# Local TF Copy
4349
tensorflow/*
4450

45-
# virtual enviroments
46-
venv/*
51+
# Ignore Python virtual enviroments
52+
venv/
53+
quantum_env/
54+
quantum_venv/
4755

4856
# ignore emacs temp files
4957
*#

BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Top-level Bazel BUILD file for TensorFlow Quantum.
2+
# This file is intentionally empty.

WORKSPACE

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
11
# This file includes external dependencies that are required to compile the
22
# TensorFlow op.
33

4+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
45

6+
# TensorFlow's .bzl files, loaded later in this file, also load rules_python
7+
# but we need a slightly newer version that is still compatible with TF's.
8+
http_archive(
9+
name = "rules_python",
10+
sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311",
11+
strip_prefix = "rules_python-0.31.0",
12+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz",
13+
)
514

6-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
15+
load("@rules_python//python:repositories.bzl", "py_repositories")
716

17+
py_repositories()
818

19+
local_repository(
20+
name = "python",
21+
path = "third_party/python_legacy",
22+
)
923

10-
EIGEN_COMMIT = "aa6964bf3a34fd607837dd8123bc42465185c4f8"
24+
load("@python//:defs.bzl", "interpreter")
25+
26+
load("@rules_python//python:pip.bzl", "pip_parse")
27+
28+
pip_parse(
29+
name = "pypi",
30+
requirements_lock = "//:requirements.txt",
31+
python_interpreter = interpreter,
32+
extra_pip_args = [
33+
"--index-url",
34+
"https://pypi.org/simple/",
35+
],
36+
)
37+
38+
load("@pypi//:requirements.bzl", "install_deps")
39+
40+
install_deps()
1141

42+
EIGEN_COMMIT = "aa6964bf3a34fd607837dd8123bc42465185c4f8"
1243

1344
http_archive(
1445
name = "eigen",
@@ -37,16 +68,13 @@ http_archive(
3768
urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.13.3.zip"],
3869
)
3970

71+
4072
http_archive(
4173
name = "org_tensorflow",
42-
patches = [
43-
"//third_party/tf:tf.patch",
44-
],
45-
sha256 = "f771db8d96ca13c72f73c85c9cfb6f5358e2de3dd62a97a9ae4b672fe4c6d094",
46-
strip_prefix = "tensorflow-2.15.0",
47-
urls = [
48-
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.15.0.zip",
49-
],
74+
patches = ["//third_party/tf:tf.patch"],
75+
sha256 = "c8c8936e7b6156e669e08b3c388452bb973c1f41538149fce7ed4a4849c7a012",
76+
strip_prefix = "tensorflow-2.16.2",
77+
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.16.2.zip"],
5078
)
5179

5280

@@ -73,8 +101,8 @@ tf_configure(name = "local_config_tf")
73101
http_archive(
74102
name = "six_archive",
75103
build_file = "@com_google_protobuf//:six.BUILD",
76-
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
77-
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55",
104+
sha256 = "ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81",
105+
url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz",
78106
)
79107

80108
bind(

0 commit comments

Comments
 (0)