From 2e2c99af54c85fbd563d80270d3058b3138eb9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Dav=C3=B3?= Date: Thu, 1 Aug 2024 08:33:08 +0000 Subject: [PATCH] Updated tf-keras for new python versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: David Davó --- recommenders/models/deeprec/models/dkn.py | 2 ++ setup.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/recommenders/models/deeprec/models/dkn.py b/recommenders/models/deeprec/models/dkn.py index 8b038dd29..a53620313 100644 --- a/recommenders/models/deeprec/models/dkn.py +++ b/recommenders/models/deeprec/models/dkn.py @@ -1,5 +1,7 @@ # Copyright (c) Recommenders contributors. # Licensed under the MIT License. +import os +os.environ['TF_USE_LEGACY_KERAS'] = "1" import numpy as np import tensorflow as tf diff --git a/setup.py b/setup.py index 740606e15..d2a10e5a4 100644 --- a/setup.py +++ b/setup.py @@ -53,9 +53,12 @@ "gpu": [ "fastai>=2.7.11,<3", "nvidia-ml-py>=11.525.84", - "tensorflow>=2.8.4,!=2.9.0.*,!=2.9.1,!=2.9.2,!=2.10.0.*,<2.17", # Fixed TF due to constant security problems and breaking changes #2073 + "tensorflow>=2.8.4,!=2.9.0.*,!=2.9.1,!=2.9.2,!=2.10.0.*,<2.16; python_version<='3.8'", # Fixed TF due to constant security problems and breaking changes #2073 + "tensorflow~=2.16; python_version>'3.8'", # Version needed for python 3.12 "tf-slim>=1.1.0", # No python_requires in its setup.py - "tf-keras<3", + # Use keras 2 instead of keras 3 + "tf-keras~=2.15; python_version<='3.8'", # Not compatible with py3.12 + "tf-keras~=2.16; python_version>'3.8'", "torch>=2.0.1,<3", ], "spark": [