From c05857de54a06e886680da692f5cdf82e2651973 Mon Sep 17 00:00:00 2001 From: Lucain Pouget Date: Thu, 18 Jul 2024 16:48:56 +0200 Subject: [PATCH] add tag only if not existent --- src/huggingface_hub/_tensorboard_logger.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/huggingface_hub/_tensorboard_logger.py b/src/huggingface_hub/_tensorboard_logger.py index 690029470c..dee2c581a9 100644 --- a/src/huggingface_hub/_tensorboard_logger.py +++ b/src/huggingface_hub/_tensorboard_logger.py @@ -182,9 +182,10 @@ def __init__( except EntryNotFoundError: card = ModelCard("") tags = card.data.get("tags", []) - tags.append("hf-summary-writer") - card.data["tags"] = tags - card.push_to_hub(repo_id=self.repo_id, repo_type=self.repo_type) + if "hf-summary-writer" not in tags: + tags.append("hf-summary-writer") + card.data["tags"] = tags + card.push_to_hub(repo_id=self.repo_id, repo_type=self.repo_type) def __exit__(self, exc_type, exc_val, exc_tb): """Push to hub in a non-blocking way when exiting the logger's context manager."""