From 0f410c2e7ca77af3108389e65c3b75e83b673d45 Mon Sep 17 00:00:00 2001 From: kba Date: Wed, 26 Nov 2025 16:37:54 +0100 Subject: [PATCH] disable tf/keras logging on first import --- src/eynollah/cli.py | 4 +++- src/eynollah/eynollah_imports.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eynollah/cli.py b/src/eynollah/cli.py index 9787054..c37864a 100644 --- a/src/eynollah/cli.py +++ b/src/eynollah/cli.py @@ -25,7 +25,9 @@ class EynollahCliCtx: "--model-basedir", "-m", help="directory of models", - type=click.Path(exists=True), + # NOTE: not mandatory to exist so --help for subcommands works but will log a warning + # and raise exception when trying to load models in the CLI + # type=click.Path(exists=True), default=f'{os.getcwd()}/models_eynollah', ) @click.option( diff --git a/src/eynollah/eynollah_imports.py b/src/eynollah/eynollah_imports.py index a57f87d..f04cfdc 100644 --- a/src/eynollah/eynollah_imports.py +++ b/src/eynollah/eynollah_imports.py @@ -1,7 +1,9 @@ """ Load libraries with possible race conditions once. This must be imported as the first module of eynollah. """ +from ocrd_utils import tf_disable_interactive_logs from torch import * +tf_disable_interactive_logs() import tensorflow.keras from shapely import * imported_libs = True