Skip to content

Commit

Permalink
build(tf): remove keras from dependencies (#3709)
Browse files Browse the repository at this point in the history
After #3696, we don't need keras anymore.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz committed Apr 25, 2024
1 parent 37c9540 commit 78c6214
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions backend/find_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ def get_tf_requirement(tf_version: str = "") -> dict:
if not (tf_version == "" or tf_version in SpecifierSet(">=2.12", prereleases=True)):
extra_requires.append("protobuf<3.20")
# keras 3 is not compatible with tf.compat.v1
if tf_version == "" or tf_version in SpecifierSet(">=2.15.0rc0", prereleases=True):
extra_requires.append("tf-keras; python_version>='3.9'")
# only TF>=2.16 is compatible with Python 3.12
extra_requires.append("tf-keras>=2.16.0rc0; python_version>='3.12'")
# 2024/04/24: deepmd.tf doesn't import tf.keras any more

if tf_version == "" or tf_version in SpecifierSet(">=1.15", prereleases=True):
extra_select["mpi"] = [
"horovod",
Expand Down
3 changes: 2 additions & 1 deletion deepmd/tf/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def dlopen_library(module: str, filename: str):

# keras 3 is incompatible with tf.compat.v1
# https://keras.io/getting_started/#tensorflow--keras-2-backwards-compatibility
os.environ["TF_USE_LEGACY_KERAS"] = "1"
# 2024/04/24: deepmd.tf doesn't import tf.keras any more

# import tensorflow v1 compatability
try:
import tensorflow.compat.v1 as tf
Expand Down

0 comments on commit 78c6214

Please sign in to comment.