Skip to content

Commit fa5084a

Browse files
committed
Only test on Python 3 and TF 2.1. | Resolves #146.
* Fix breaking BUILD rules. * Delete unused `adanet.keras` to free up namespace. * Use `import tensorflow.compat.v2 as tf` where possible. * Drop Python 2 support. * Drop TensorFlow 1.* support. * Remove google_typing future import. * Rename `get_test_data` to `get_holdout_data` to not confuse test runner. Copybara import of the project: - fdebb94 Only test on Python 3 and TF 2.1. by Charles Weill <[email protected]> - 99b8f53 Remove google future import and rename helper method to n... by Charles Weill <[email protected]> - 1129fc5 Fix failing test. by Charles Weill <[email protected]> - ba09b4a Fix failing test again. by Charles Weill <[email protected]> - a551c8f Remove adanet.keras module. by Charles Weill <[email protected]> - 2cd0709 Remove remaining keras BUILD targets. by Charles Weill <[email protected]> - 3e85863 Remove lingering keras autoensemble modules. by Charles Weill <[email protected]> - 72d59f2 Fix adanet_test.py by Charles Weill <[email protected]> - 8e6286d Merge 72d59f2 into 14920... by Charles Weill <[email protected]> PiperOrigin-RevId: 292949559
1 parent 149202e commit fa5084a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+98
-1027
lines changed

.travis.yml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,51 @@ git:
55
depth: 10
66
quiet: true
77
python:
8-
- "2.7"
98
- "3.6"
109
env:
1110
global:
1211
- CODECOV_TOKEN="0d2c482b-f42c-4d4c-b092-cb628ad20857"
1312
- BAZEL_VERSION=0.20.0
1413
- COVERAGE_PROCESS_START=$PWD/.coveragerc
15-
- NODE_TOTAL=3 # Total machines running per test setting
14+
- NODE_TOTAL=8 # Total machines running per test setting
1615
matrix:
1716
# We test against recent versions of TensorFlow and tf-nightly.
1817

19-
# Quick test suite.
20-
- TF_VERSION="1.15.*" NODE_INDEX=0
21-
- TF_VERSION="1.15.*" NODE_INDEX=1
22-
- TF_VERSION="1.15.*" NODE_INDEX=2
2318
- TF_VERSION="tf-nightly" NODE_INDEX=0
2419
- TF_VERSION="tf-nightly" NODE_INDEX=1
2520
- TF_VERSION="tf-nightly" NODE_INDEX=2
26-
- TF_VERSION="2.0.0" NODE_INDEX=0
27-
- TF_VERSION="2.0.0" NODE_INDEX=1
28-
- TF_VERSION="2.0.0" NODE_INDEX=2
29-
- TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=0
30-
- TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=1
31-
- TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=2
21+
- TF_VERSION="tf-nightly" NODE_INDEX=3
22+
- TF_VERSION="tf-nightly" NODE_INDEX=4
23+
- TF_VERSION="tf-nightly" NODE_INDEX=5
24+
- TF_VERSION="tf-nightly" NODE_INDEX=6
25+
- TF_VERSION="tf-nightly" NODE_INDEX=7
26+
- TF_VERSION="2.1" NODE_INDEX=0
27+
- TF_VERSION="2.1" NODE_INDEX=1
28+
- TF_VERSION="2.1" NODE_INDEX=2
29+
- TF_VERSION="2.1" NODE_INDEX=3
30+
- TF_VERSION="2.1" NODE_INDEX=4
31+
- TF_VERSION="2.1" NODE_INDEX=5
32+
- TF_VERSION="2.1" NODE_INDEX=6
33+
- TF_VERSION="2.1" NODE_INDEX=7
3234

3335
matrix:
3436
allow_failures:
35-
- python: "2.7"
36-
env: TF_VERSION="tf-nightly" NODE_INDEX=0
37-
- python: "2.7"
38-
env: TF_VERSION="tf-nightly" NODE_INDEX=1
39-
- python: "2.7"
40-
env: TF_VERSION="tf-nightly" NODE_INDEX=2
4137
- python: "3.6"
4238
env: TF_VERSION="tf-nightly" NODE_INDEX=0
4339
- python: "3.6"
4440
env: TF_VERSION="tf-nightly" NODE_INDEX=1
4541
- python: "3.6"
4642
env: TF_VERSION="tf-nightly" NODE_INDEX=2
47-
- python: "2.7"
48-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=0
49-
- python: "2.7"
50-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=1
51-
- python: "2.7"
52-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=2
5343
- python: "3.6"
54-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=0
44+
env: TF_VERSION="tf-nightly" NODE_INDEX=3
45+
- python: "3.6"
46+
env: TF_VERSION="tf-nightly" NODE_INDEX=4
47+
- python: "3.6"
48+
env: TF_VERSION="tf-nightly" NODE_INDEX=5
5549
- python: "3.6"
56-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=1
50+
env: TF_VERSION="tf-nightly" NODE_INDEX=6
5751
- python: "3.6"
58-
env: TF_VERSION="tf-nightly-2.0-preview" NODE_INDEX=2
52+
env: TF_VERSION="tf-nightly" NODE_INDEX=7
5953

6054
before_install:
6155
- sudo apt-get -y install pkg-config zip g++ zlib1g-dev unzip

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ To get you started:
9191

9292
## Requirements
9393

94-
Requires [Python](https://www.python.org/) 2.7, 3.4, 3.5, 3.6, or 3.7.
94+
Requires [Python](https://www.python.org/) 3.6 or above.
9595

96-
`adanet` supports both TensorFlow 2.0 and TensorFlow >=1.15. It depends on bug fixes and enhancements not present in TensorFlow releases prior to 1.15. You must install or upgrade your TensorFlow package to at least 1.15:
96+
`adanet` is built on TensorFlow 2.1. It depends on bug fixes and enhancements not present in TensorFlow releases prior to 2.1. You must install or upgrade your TensorFlow package to at least 2.1:
9797

9898
```shell
99-
$ pip install "tensorflow==2.0.0" # Or pip install "tensorflow==1.15.*"
99+
$ pip install "tensorflow==2.1"
100100
```
101101

102102
## Installing with Pip
@@ -122,8 +122,7 @@ From the `adanet` root directory run the tests:
122122

123123
```shell
124124
$ bazel build -c opt //...
125-
# Run tests with nosetests, but skip example tests.
126-
$ NOSE_EXCLUDE='.*nasnet.*.py.*' python3 -m nose
125+
$ python3 -m nose
127126
```
128127

129128
Once you have verified that the tests have passed, install `adanet` from source as a [ pip package ](./adanet/pip_package/PIP.md).

adanet/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ py_library(
1919
"//adanet/core",
2020
"//adanet/distributed",
2121
"//adanet/ensemble",
22-
"//adanet/keras",
2322
"//adanet/replay",
2423
"//adanet/subnetwork",
2524
],

adanet/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020

2121
from adanet import distributed
2222
from adanet import ensemble
23-
from adanet import keras
2423
from adanet import replay
2524
from adanet import subnetwork
26-
from adanet.autoensemble import AutoEnsemble
2725
from adanet.autoensemble import AutoEnsembleEstimator
2826
from adanet.autoensemble import AutoEnsembleSubestimator
2927
from adanet.autoensemble import AutoEnsembleTPUEstimator
@@ -37,13 +35,11 @@
3735
from adanet.ensemble import ComplexityRegularized as Ensemble
3836
from adanet.ensemble import MixtureWeightType
3937
from adanet.ensemble import WeightedSubnetwork
40-
from adanet.keras import Model
4138
from adanet.subnetwork import Subnetwork
4239

4340
from adanet.version import __version__
4441

4542
__all__ = [
46-
"AutoEnsemble",
4743
"AutoEnsembleEstimator",
4844
"AutoEnsembleSubestimator",
4945
"AutoEnsembleTPUEstimator",
@@ -52,8 +48,6 @@
5248
"Ensemble",
5349
"Estimator",
5450
"Evaluator",
55-
"keras",
56-
"Model",
5751
"replay",
5852
"ReportMaterializer",
5953
"subnetwork",

adanet/adanet_test.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class AdaNetTest(tf.test.TestCase):
2828

2929
def test_public(self):
3030
self.assertIsNotNone(adanet.__version__)
31-
self.assertIsNotNone(adanet.AutoEnsemble)
3231
self.assertIsNotNone(adanet.AutoEnsembleEstimator)
3332
self.assertIsNotNone(adanet.AutoEnsembleSubestimator)
3433
self.assertIsNotNone(adanet.AutoEnsembleTPUEstimator)
@@ -51,9 +50,6 @@ def test_public(self):
5150
self.assertIsNotNone(adanet.Ensemble)
5251
self.assertIsNotNone(adanet.Estimator)
5352
self.assertIsNotNone(adanet.Evaluator)
54-
self.assertIsNotNone(adanet.keras.Model)
55-
self.assertIsNotNone(adanet.keras.AutoEnsemble)
56-
self.assertIsNotNone(adanet.Model)
5753
self.assertIsNotNone(adanet.MixtureWeightType)
5854
self.assertIsNotNone(adanet.replay.Config)
5955
self.assertIsNotNone(adanet.ReportMaterializer)

adanet/autoensemble/BUILD

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ py_library(
1212
deps = [
1313
":common",
1414
":estimator",
15-
":keras",
1615
],
1716
)
1817

@@ -26,17 +25,6 @@ py_library(
2625
],
2726
)
2827

29-
py_library(
30-
name = "keras",
31-
srcs = ["keras.py"],
32-
visibility = ["//adanet/keras:__subpackages__"],
33-
deps = [
34-
":common",
35-
"//adanet/keras:model",
36-
"@absl_py//absl/logging",
37-
],
38-
)
39-
4028
py_library(
4129
name = "estimator",
4230
srcs = ["estimator.py"],
@@ -46,17 +34,6 @@ py_library(
4634
],
4735
)
4836

49-
py_test(
50-
name = "keras_test",
51-
size = "medium",
52-
srcs = ["keras_test.py"],
53-
deps = [
54-
":keras",
55-
"//adanet/tf_compat",
56-
"@absl_py//absl/testing:parameterized",
57-
],
58-
)
59-
6037
py_test(
6138
name = "estimator_test",
6239
size = "large",

adanet/autoensemble/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
from adanet.autoensemble.common import AutoEnsembleSubestimator
2323
from adanet.autoensemble.estimator import AutoEnsembleEstimator
2424
from adanet.autoensemble.estimator import AutoEnsembleTPUEstimator
25-
from adanet.autoensemble.keras import AutoEnsemble
2625

2726
__all__ = [
2827
"AutoEnsembleEstimator",
2928
"AutoEnsembleSubestimator",
3029
"AutoEnsembleTPUEstimator",
31-
"AutoEnsemble",
3230
]

adanet/autoensemble/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from adanet import subnetwork as subnetwork_lib
2626
from adanet import tf_compat
2727

28-
import tensorflow as tf
28+
import tensorflow.compat.v2 as tf
2929

3030

3131
def _default_logits(estimator_spec):

adanet/autoensemble/estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from adanet import core
2323
from adanet.autoensemble.common import _GeneratorFromCandidatePool
2424

25-
import tensorflow as tf
25+
import tensorflow.compat.v2 as tf
2626

2727

2828
class AutoEnsembleEstimator(core.Estimator): # pylint: disable=g-classes-have-attributes

adanet/autoensemble/estimator_v2_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from absl.testing import parameterized
2828
from adanet import tf_compat
2929
from adanet.autoensemble.estimator import AutoEnsembleEstimator
30-
import tensorflow as tf
30+
import tensorflow.compat.v2 as tf
3131

3232
# pylint: disable=g-direct-tensorflow-import
3333
from tensorflow.python.estimator.export import export

0 commit comments

Comments
 (0)