+
    –°³j/   ã                   ó`   € R t ^ RIHt ^RIHt ^RIHt ^RIHt ^RI	H
t
 R t ! R R4      tR	# )
zFContains a logger to push training logs to the Hub, using Tensorboard.)ÚPath)ÚCommitScheduler)ÚEntryNotFoundError)Ú	ModelCard)Úexperimentalc                 ó|   €  ^ RI Hp  V #   \         d'     ^ RIHp   T #   \         d    \        R4      Rhi ; ii ; i)zQLoad a SummaryWriter implementation only when an HFSummaryWriter is instantiated.©ÚSummaryWriterzvYou must have `tensorboard` installed to use `HFSummaryWriter`. Please run `pip install --upgrade tensorboardX` first.N)ÚtensorboardXr	   ÚImportErrorÚtorch.utils.tensorboardr   s    Úd/home/luca/screen-checking/.venv/lib/python3.14/site-packages/huggingface_hub/_tensorboard_logger.pyÚ_load_summary_writerr      s[   € ð	Ý.ð Ðøô ô ð	Þ=ð Ðøô ô 	Üð(óð ðð	úðús   ‚
 Š;–Ÿ7·;c                   ó´   a a€ ] tR t^'t oRt]V3R lV 3R ll4       tRRR^RRR	RR
RRRRRRRRRRR/
V3R lR lltV3R lR ltV3R lR lt	R t
RtVtV ;t# )ÚHFSummaryWritera¤  
Wrapper around the tensorboard's `SummaryWriter` to push training logs to the Hub.

Data is logged locally and then pushed to the Hub asynchronously. Pushing data to the Hub is done in a separate
thread to avoid blocking the training script. In particular, if the upload fails for any reason (e.g. a connection
issue), the main script will not be interrupted. Data is automatically pushed to the Hub every `commit_every`
minutes (default to every 5 minutes).

> [!WARNING]
> `HFSummaryWriter` is experimental. Its API is subject to change in the future without prior notice.

Args:
    repo_id (`str`):
        The id of the repo to which the logs will be pushed.
    logdir (`str`, *optional*):
        The directory where the logs will be written. If not specified, a local directory will be created by the
        underlying `SummaryWriter` object.
    commit_every (`int` or `float`, *optional*):
        The frequency (in minutes) at which the logs will be pushed to the Hub. Defaults to 5 minutes.
    squash_history (`bool`, *optional*):
        Whether to squash the history of the repo after each commit. Defaults to `False`. Squashing commits is
        useful to avoid degraded performances on the repo when it grows too large.
    repo_type (`str`, *optional*):
        The type of the repo to which the logs will be pushed. Defaults to "model".
    repo_revision (`str`, *optional*):
        The revision of the repo to which the logs will be pushed. Defaults to "main".
    repo_private (`bool`, *optional*):
        Whether to make the repo private. If `None` (default), the repo will be public unless the organization's default is private. This value is ignored if the repo already exists.
    path_in_repo (`str`, *optional*):
        The path to the folder in the repo where the logs will be pushed. Defaults to "tensorboard/".
    repo_allow_patterns (`list[str]` or `str`, *optional*):
        A list of patterns to include in the upload. Defaults to `"*.tfevents.*"`. Check out the
        [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#upload-a-folder) for more details.
    repo_ignore_patterns (`list[str]` or `str`, *optional*):
        A list of patterns to exclude in the upload. Check out the
        [upload guide](https://huggingface.co/docs/huggingface_hub/guides/upload#upload-a-folder) for more details.
    token (`str`, *optional*):
        Authentication token. Will default to the stored token. See https://huggingface.co/settings/token for more
        details
    kwargs:
        Additional keyword arguments passed to `SummaryWriter`.

Examples:
```diff
# Taken from https://pytorch.org/docs/stable/tensorboard.html
- from torch.utils.tensorboard import SummaryWriter
+ from huggingface_hub import HFSummaryWriter

import numpy as np

- writer = SummaryWriter()
+ writer = HFSummaryWriter(repo_id="username/my-trained-model")

for n_iter in range(100):
    writer.add_scalar('Loss/train', np.random.random(), n_iter)
    writer.add_scalar('Loss/test', np.random.random(), n_iter)
    writer.add_scalar('Accuracy/train', np.random.random(), n_iter)
    writer.add_scalar('Accuracy/test', np.random.random(), n_iter)
```

```py
>>> from huggingface_hub import HFSummaryWriter

# Logs are automatically pushed every 15 minutes (5 by default) + when exiting the context manager
>>> with HFSummaryWriter(repo_id="test_hf_logger", commit_every=15) as logger:
...     logger.add_scalar("a", 1)
...     logger.add_scalar("b", 2)
```
c                ó   <€ V ^8„  d   QhRR/# ©é   Úreturnr   © )ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚHFSummaryWriter.__annotate__o   s   ø€ ÷ $ñ $Ð):ñ $ó    c                ó"   <€ \         SV `  V 4      # ©N)ÚsuperÚ__new__)ÚclsÚargsÚkwargsÚ	__class__s   &*,€r   r   ÚHFSummaryWriter.__new__n   s   ø€ ä‰w‰˜sÓ#Ð#r   ÚlogdirNÚcommit_everyÚsquash_historyFÚ	repo_typeÚrepo_revisionÚrepo_privateÚpath_in_repoÚtensorboardÚrepo_allow_patternsz*.tfevents.*Úrepo_ignore_patternsÚtokenc                ó  <€ V ^8„  d   QhRS[ RS[ R,          RS[S[,          RS[RS[ R,          RS[ R,          RS[R,          R	S[ R,          R
S[S[ ,          S[ ,          R,          RS[S[ ,          S[ ,          R,          RS[ R,          /# )r   Úrepo_idr$   Nr%   r&   r'   r(   r)   r*   r,   r-   r.   )ÚstrÚintÚfloatÚboolÚlist)r   r   s   "€r   r   r   r   s¼   ø€ ÷ ;Mñ ;Máð;Mñ �d•
ð	;Mñ
 ™E•kð;Mñ ð;Mñ ˜•:ð;Mñ ˜T•zð;Mñ ˜T•kð;Mñ ˜D•jð;Mñ "¡#�Y©�_¨tÕ3ð;Mñ #¡3�i©#�o°Õ4ð;Mñ �T�zñ;Mr   c       
        ó*  € \        4       ! RR V/VB V n        V P                  P                  V n        \        V P                  \        4      '       g0   \        RV P                   R\        V P                  4       R24      hVe   VR8X  d!   \        V P                  4      P                  pM<VP                  R4      R,           \        V P                  4      P                  ,           p\        V P                  VVVVVVV	V
VVR7      V n        V P                  P                  V n        V P                  P                  V n        V P                  P                  V n         \         P"                  ! V P                  V P                  R7      pVP&                  P)                  R	. 4      pR
V9  dI   VP+                  R
4       WíP&                  R	&   VP-                  V P                  V P                  R7       R# R#   \$         d    \!        R4      p L…i ; i)r$   z%`self.logdir` must be a string. Got 'z
' of type Ú.NÚ Ú/)Úfolder_pathr*   r0   r'   ÚrevisionÚprivater.   Úallow_patternsÚignore_patternsÚeveryr&   )Úrepo_id_or_pathr'   Útagszhf-summary-writer)r0   r'   r   )r   Ú_summary_writerr$   Ú
isinstancer1   Ú
ValueErrorÚtyper   ÚnameÚstripr   Ú	schedulerr0   r'   r;   r(   r   Úloadr   ÚdataÚgetÚappendÚpush_to_hub)Úselfr0   r$   r%   r&   r'   r(   r)   r*   r,   r-   r.   r!   ÚcardrA   s   &&$$$$$$$$$$,  r   Ú__init__ÚHFSummaryWriter.__init__r   s´  € ô"  4Ô5ÑN¸VÐNÀvÑNˆÔØ×*Ñ*×1Ñ1ˆŒô ˜$Ÿ+™+¤s×+Ò+ÜÐDÀTÇ[Á[ÀMÐQ[Ô\`Ðae×alÑalÓ\mÐ[nÐnoÐpÓqÐqð Ò <°2Ô#5Ü §¡Ó,×1Ñ1‰Là'×-Ñ-¨cÓ2°SÕ8¼4ÀÇÁÓ;L×;QÑ;QÕQˆLô )ØŸ™Ø%ØØØ"Ø ØØ.Ø0ØØ)ô
ˆŒð —~‘~×-Ñ-ˆŒØŸ™×1Ñ1ˆŒØ!Ÿ^™^×4Ñ4ˆÔð	!Ü—>’>°$·,±,È$Ï.É.ÔYˆDð �y‰y�}‰}˜V RÓ(ˆØ dÔ*Ø�K‰KÐ+Ô,Ø $�I‰I�fÑØ×Ñ T§\¡\¸T¿^¹^ÐÖLñ +øô "ô 	!Ü˜R“=ŠDð	!ús   Å ,G9 Ç9HÈHc                ó    <€ V ^8„  d   QhRS[ /# )r   rF   )r1   )r   r   s   "€r   r   r   ¯   s   ø€ ÷ 3ñ 3¡ñ 3r   c                ó.   € \        V P                  V4      # )z;Forward the SummaryWriter API to the lazily-created writer.)ÚgetattrrB   )rN   rF   s   &&r   Ú__getattr__ÚHFSummaryWriter.__getattr__¯   s   € ä�t×+Ñ+¨TÓ2Ð2r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   ³   s   ø€ ÷ ñ Ð,ñ r   c                ó:   € V P                   P                  4        V # r   )rB   Ú	__enter__)rN   s   &r   rY   ÚHFSummaryWriter.__enter__³   s   € Ø×Ñ×&Ñ&Ô(Øˆr   c                ó’   € V P                   P                  WV4       V P                  P                  4       pVP	                  4        R# )zLPush to hub in a non-blocking way when exiting the logger's context manager.N)rB   Ú__exit__rH   ÚtriggerÚresult)rN   Úexc_typeÚexc_valÚexc_tbÚfutures   &&&& r   r\   ÚHFSummaryWriter.__exit__·   s3   € à×Ñ×%Ñ% h¸Ô@Ø—‘×'Ñ'Ó)ˆØ�‰Žr   )rB   r$   r0   r(   r'   rH   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   rP   rU   rY   r\   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r"   r   s   @@r   r   r   '   s¿   ù‡ € ñDðL ÷$ò $ó ð$ð;Mð "ð	;Mð
 %&ð;Mð  %ð;Mð !%ð;Mð %)ð;Mð %)ð;Mð $1ð;Mð 7Eð;Mð 8<ð;Mð !÷;Mò ;M÷z3ð 3÷ð ÷ò r   r   N)rh   Úpathlibr   Ú_commit_schedulerr   Úerrorsr   Úrepocardr   Úutilsr   r   r   r   r   r   Ú<module>rq      s+   ðñ Må å .Ý &Ý Ý ò÷Tó Tr   