Ë
    ÿÍ:jï  ã                   ó<   — d dl mZ d dlmZ d dlmZ  G d„ d«      Zy)é    )ÚOptionalN)Ú_BaseProgressc                   óæ   — e Zd ZdZdd„Zedefd„«       Zej                  deddfd„«       Zedefd„«       Z	dd	„Z
defd
„Zdeddfd„Zddee   dedefd„Z	 ddededdfd„Zdededdfd„Zdd„Zy)Ú_LoopzBasic Loops interface.ÚreturnNc                 ó<   — d| _         d| _        d| _        || _        y ©NF)Ú_restartingÚ_loaded_from_state_dictÚ_resuming_from_checkpointÚtrainer)Úselfr   s     úq/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/lightning/pytorch/loops/loop.pyÚ__init__z_Loop.__init__   s!   € Ø ˆÔØ',ˆÔ$Ø).ˆÔ&Øˆ�ó    c                 ó   — | j                   S )zDWhether the state of this loop was reloaded and it needs to restart.)r
   ©r   s    r   Ú
restartingz_Loop.restarting   s   € ð ×ÑÐr   r   c                 ó~   — || _         t        | «      j                  «       D ]  }t        |t        «      sŒ||_        Œ y)z7Connects this loop's restarting value and its children.N)r
   ÚvarsÚvaluesÚ
isinstancer   r   )r   r   Úloops      r   r   z_Loop.restarting"   s9   € ð &ˆÔÜ˜“J×%Ñ%Ó'ò 	-ˆDÜ˜$¤Õ&Ø",�•ñ	-r   c                 ó   — | j                   S )z>Indicates whether training is being resumed from a checkpoint.)r   r   s    r   Úis_resumingz_Loop.is_resuming*   s   € ð ×-Ñ-Ð-r   c                  ó   — y )N© r   s    r   Úreset_restart_stagez_Loop.reset_restart_stage/   s   € Ør   c                 ó   — i S )z�Called when saving a model checkpoint, use to persist loop state.

        Returns:
            The current loop state.

        r   r   s    r   Úon_save_checkpointz_Loop.on_save_checkpoint2   s	   € ð ˆ	r   Ú
state_dictc                  ó   — y)zACalled when loading a model checkpoint, use to reload loop state.Nr   )r   r!   s     r   Úon_load_checkpointz_Loop.on_load_checkpoint;   s   � r   ÚdestinationÚprefixc                 ó  — |€i }| j                  «       ||dz   <   | j                  j                  «       D ]T  \  }}||z   }t        |t        «      r|j                  «       ||<   Œ/t        |t        «      sŒ@|j                  ||dz   «       ŒV |S )a?  The state dict is determined by the state and progress of this loop and all its children.

        Args:
            destination: An existing dictionary to update with this loop's state. By default a new dictionary
                is returned.
            prefix: A prefix for each key in the state dictionary

        r!   ú.)r    Ú__dict__Úitemsr   r   r!   r   )r   r$   r%   ÚkÚvÚkeys         r   r!   z_Loop.state_dict>   sŽ   € ð ÐØˆKà-1×-DÑ-DÓ-Fˆ�F˜\Ñ)Ñ*à—M‘M×'Ñ'Ó)ò 	5‰DˆAˆqØ˜1‘*ˆCÜ˜!œ]Ô+Ø#$§<¡<£>�˜CÒ Ü˜AœuÕ%Ø—‘˜[¨#°©)Õ4ð	5ð Ðr   c                 ó   — | j                  |j                  «       |«       | j                  j                  «       D ]<  \  }}t	        |t
        «      sŒ|j                  |j                  «       ||z   dz   «       Œ> d| _        d| _        d| _	        y)z2Loads the state of this loop and all its children.r'   TN)
Ú_load_from_state_dictÚcopyr(   r)   r   r   Úload_state_dictr   r   r   )r   r!   r%   r*   r+   s        r   r0   z_Loop.load_state_dictT   s€   € ð 	×"Ñ" :§?¡?Ó#4°fÔ=Ø—M‘M×'Ñ'Ó)ò 	G‰DˆAˆqÜ˜!œUÕ#Ø×!Ñ! *§/¡/Ó"3°V¸a±ZÀ#Ñ5EÕFð	Gð ˆŒØ'+ˆÔ$Ø)-ˆÕ&r   c                 óä   — | j                   j                  «       D ]4  \  }}||z   }||vrŒt        |t        «      sŒ!|j	                  ||   «       Œ6 |dz   |v r| j                  ||dz      «       y y )Nr!   )r(   r)   r   r   r0   r#   )r   r!   r%   r*   r+   r,   s         r   r.   z_Loop._load_from_state_dictb   s~   € Ø—M‘M×'Ñ'Ó)ò 	3‰DˆAˆqØ˜1‘*ˆCØ˜*Ñ$àÜ˜!œ]Õ+Ø×!Ñ! *¨S¡/Õ2ð	3ð �LÑ  JÑ.Ø×#Ñ# J¨v¸Ñ/DÑ$EÕFð /r   c                 óN   — d| _         d| _        d| _        | j                  «        y r	   )r
   r   r   r   r   s    r   Úon_iteration_donez_Loop.on_iteration_donem   s&   € Ø ˆÔØ',ˆÔ$Ø).ˆÔ&Ø× Ñ Õ"r   )r   z
pl.Trainerr   N)r   N)NÚ )r4   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpropertyÚboolr   Úsetterr   r   Údictr    r#   r   Ústrr!   r0   r.   r3   r   r   r   r   r      s÷   „ Ù óð ð ˜Dò  ó ð ð ×Ñð- Tð -¨dò -ó ð-ð ð.˜Tò .ó ð.óð Dó ðP¨Tð P°dó Pñ h¨t¡nð ÀSð ÐRVó ð2 ñ.àð.ð ð.ð 
ó	.ð	G°ð 	G¸cð 	GÀdó 	Gô#r   r   )Útypingr   Úlightning.pytorchÚpytorchÚplÚ lightning.pytorch.loops.progressr   r   r   r   r   ú<module>rC      s   ðõ å Ý :÷]#ò ]#r   