From d128f2ffab126c267b4b7cfe4a91f2692d06c69f Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 7 Mar 2023 15:54:10 +0000 Subject: [PATCH] Stop requiring Torch for our TF examples! (#21997) * Stop requiring Torch for our TF examples! * Slight tweak to logging in the example itself --- examples/tensorflow/contrastive-image-text/run_clip.py | 5 ++--- src/transformers/training_args_tf.py | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/tensorflow/contrastive-image-text/run_clip.py b/examples/tensorflow/contrastive-image-text/run_clip.py index 7f153ce75a..9dad78eb16 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) diff --git a/src/transformers/training_args_tf.py b/src/transformers/training_args_tf.py index 3cacfba16e..847bbdb78a 100644 --- a/src/transformers/training_args_tf.py +++ b/src/transformers/training_args_tf.py @@ -249,6 +249,13 @@ class TFTrainingArguments(TrainingArguments): 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: """