From d8ef118db2276154a41476165aced918a0a09258 Mon Sep 17 00:00:00 2001 From: kAIto47802 <115693559+kAIto47802@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:42:00 +0900 Subject: [PATCH] Add version check --- tensorflow/tensorflow_estimator_integration.py | 8 ++++++++ tensorflow/tensorflow_estimator_simple.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/tensorflow/tensorflow_estimator_integration.py b/tensorflow/tensorflow_estimator_integration.py index 0e3d8fcf..e04e1523 100644 --- a/tensorflow/tensorflow_estimator_integration.py +++ b/tensorflow/tensorflow_estimator_integration.py @@ -12,6 +12,7 @@ """ import shutil +import sys import tempfile import urllib @@ -133,4 +134,11 @@ def main(): if __name__ == "__main__": + if sys.version_info >= (3, 12): + raise RuntimeError( + "Use `optuna_integration.KerasPruningCallback` instead, " + "because TensorFlow recommends migrating from Estimator to Keras APIs. " + "For more details, please check the TensorFlow migration guide: " + "https://www.tensorflow.org/guide/migrate/migrating_estimator" + ) main() diff --git a/tensorflow/tensorflow_estimator_simple.py b/tensorflow/tensorflow_estimator_simple.py index 82207fdc..68c47390 100644 --- a/tensorflow/tensorflow_estimator_simple.py +++ b/tensorflow/tensorflow_estimator_simple.py @@ -11,6 +11,7 @@ import shutil import tempfile import urllib +import sys import optuna from packaging import version @@ -123,4 +124,10 @@ def main(): if __name__ == "__main__": + if sys.version_info >= (3, 12): + raise RuntimeError( + "Use Keras APIs instead of Estimator API in TensorFlow. " + "For more details, please check the TensorFlow migration guide: " + "https://www.tensorflow.org/guide/migrate/migrating_estimator" + ) main()