Skip to content

Commit df00d77

Browse files
TensorFlow Hub Authorscopybara-github
authored andcommitted
Use tf-keras-nightly for tf-hub-nightly.
PiperOrigin-RevId: 604578087
1 parent 02e1581 commit df00d77

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

tensorflow_hub/pip_package/build_pip_package.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ function main() {
5858
cp "tensorflow_hub/LICENSE" "${TMPDIR}/LICENSE.txt"
5959
cp -R "${RUNFILES}/tensorflow_hub" "${TMPDIR}"
6060

61-
# Remove this once the library supports Keras 3.
62-
# Install tf-keras-nightly instead if tf-nightly is installed.
63-
if [[ $TENSORFLOW_VERSION == *tf-nightly ]]
64-
then
65-
sed -i "s|tf-keras|tf-keras-nightly|g" "${TMPDIR}/setup.py"
66-
else
67-
echo "Did not replace dependency on tf-keras"
68-
fi
69-
7061
pushd ${TMPDIR}
7162
rm -f MANIFEST
7263

tensorflow_hub/pip_package/setup.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
"""Setup for pip package."""
1616

1717
from datetime import datetime
18+
import os
19+
import sys
20+
1821
from setuptools import find_packages
1922
from setuptools import setup
2023

21-
import sys
2224

2325
# Can't import the module during setup.py.
2426
# Use execfile to find __version__.
@@ -28,7 +30,6 @@
2830
REQUIRED_PACKAGES = [
2931
'numpy >= 1.12.0',
3032
'protobuf >= 3.19.6', # No less than what ../WORKSPACE uses.
31-
'tf-keras >= 2.14.1',
3233
]
3334

3435
project_name = 'tensorflow-hub'
@@ -41,9 +42,19 @@
4142
# If we're dealing with a nightly build we need to make sure that the
4243
# version changes for every release.
4344
version = __version__
45+
is_nightly = False
4446
if project_name == 'tf-hub-nightly':
47+
is_nightly = True
4548
version += datetime.now().strftime('%Y%m%d%H%M')
4649

50+
if os.environ.get('TENSORFLOW_VERSION', '').endswith('tf-nightly'):
51+
is_nightly = True
52+
53+
if is_nightly:
54+
REQUIRED_PACKAGES += ['tf-keras-nightly']
55+
else:
56+
REQUIRED_PACKAGES += ['tf-keras >= 2.14.1']
57+
4758
setup(
4859
name=project_name, # Automatic: tensorflow_hub, etc. Case insensitive.
4960
version=version.replace('-', ''),
@@ -83,4 +94,4 @@
8394
'tensorflow machine learning share module subgraph component hub '
8495
'embedding retraining transfer'
8596
),
86-
)
97+
)

0 commit comments

Comments
 (0)