From 4fb47ec35bd59be6e372d52baa41584725d911d8 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Mar 2023 13:44:36 +0000 Subject: [PATCH 1/2] Stop requiring Torch for our TF examples! --- src/transformers/training_args_tf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/transformers/training_args_tf.py b/src/transformers/training_args_tf.py index 3cacfba16e8f..847bbdb78a15 100644 --- a/src/transformers/training_args_tf.py +++ b/src/transformers/training_args_tf.py @@ -249,6 +249,13 @@ def n_replicas(self) -> int: requires_backends(self, ["tf"]) return self._setup_strategy.num_replicas_in_sync + @property + def should_log(self): + """ + Whether or not the current process should produce log. + """ + return False # TF Logging is handled by Keras not the Trainer + @property def train_batch_size(self) -> int: """ From f0a835327be7c87fdc0bdb1bf564a13dc55f03db Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Mar 2023 14:05:50 +0000 Subject: [PATCH 2/2] Slight tweak to logging in the example itself --- examples/tensorflow/contrastive-image-text/run_clip.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/tensorflow/contrastive-image-text/run_clip.py b/examples/tensorflow/contrastive-image-text/run_clip.py index 7f153ce75a6f..9dad78eb163b 100644 --- a/examples/tensorflow/contrastive-image-text/run_clip.py +++ b/examples/tensorflow/contrastive-image-text/run_clip.py @@ -273,9 +273,8 @@ def main(): handlers=[logging.StreamHandler(sys.stdout)], ) - if training_args.should_log: - # The default of training_args.log_level is passive, so we set log level at info here to have that default. - transformers.utils.logging.set_verbosity_info() + # The default of training_args.log_level is passive, so we set log level at info here to have that default. + transformers.utils.logging.set_verbosity_info() log_level = training_args.get_process_log_level() logger.setLevel(log_level)