Skip to content

Commit

Permalink
add tag only if not existent
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Jul 18, 2024
1 parent add3fd4 commit c05857d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/huggingface_hub/_tensorboard_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit c05857d

Please sign in to comment.