Ë
      çiI  ã                   ó:   — d dl mZmZmZ d dlmZ  G d„ de«      Zy)é    )ÚAnyÚCallableÚOptional)Úoverridec                   ó’   — e Zd ZdZ	 	 	 ddedee   dee   dededefd	„Z	e
dded
ee   defd„«       Zdeddfd„Zdefd„Zdefd„Zy)Ú_StrategyRegistrya>  This class is a Registry that stores information about the Training Strategies.

    The Strategies are mapped to strings. These strings are names that identify
    a strategy, e.g., "deepspeed". It also returns Optional description and
    parameters to initialize the Strategy, which were defined durng the
    registration.

    The motivation for having a StrategyRegistry is to make it convenient
    for the Users to try different Strategies by passing just strings
    to the strategy flag to the Trainer.

    Example::

        @StrategyRegistry.register("lightning", description="Super fast", a=1, b=True)
        class LightningStrategy:
            def __init__(self, a, b):
                ...

        or

        StrategyRegistry.register("lightning", LightningStrategy, description="Super fast", a=1, b=True)

    NÚnameÚstrategyÚdescriptionr   Úinit_paramsÚreturnc                 óÒ   ‡ ‡‡— ‰�t        ‰t        «      st        d‰› �«      ‚‰‰ v r|st        d‰› d�«      ‚i Š|�|nd‰d<   |‰d<   dt        dt        fˆˆˆ fd	„}|� ||«      S |S )
a�  Registers a strategy mapped to a name and with required metadata.

        Args:
            name : the name that identifies a strategy, e.g. "deepspeed_stage_3"
            strategy : strategy class
            description : strategy description
            override : overrides the registered strategy, if True
            init_params: parameters to initialize the strategy

        z`name` must be a str, found Ú'z@' is already present in the registry. HINT: Use `override=True`.Ú r   r   r
   r   c                 ó&   •— | ‰d<   ‰‰d<   ‰‰‰<   | S )Nr
   Ústrategy_name© )r
   Údatar	   Úselfs    €€€úy/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/lightning_fabric/strategies/registry.pyÚdo_registerz/_StrategyRegistry.register.<locals>.do_registerI   s%   ø€ Ø'ˆD�ÑØ$(ˆD�Ñ!ØˆD�‰JØˆOó    )Ú
isinstanceÚstrÚ	TypeErrorÚ
ValueErrorr   )r   r	   r
   r   r   r   r   r   s   ``     @r   Úregisterz_StrategyRegistry.register,   s�   ú€ ð$ �¤
¨4´Ô 5ÜÐ:¸4¸&ÐAÓBÐBà�4‰<¡Ü˜q  Ð&fÐgÓhÐhà!ˆØ-8Ð-D™kÈ"ˆˆ]Ñà)ˆˆ]Ñð	¤(ð 	¬x÷ 	ð ÐÙ˜xÓ(Ð(àÐr   Údefaultc                 óÊ   — || v r| |   } |d   di |d   ¤ŽS |�|S d}dj                  t        | j                  «       «      «      xs d}t        |j	                  ||«      «      ‚)zÊCalls the registered strategy with the required parameters and returns the strategy object.

        Args:
            name (str): the name that identifies a strategy, e.g. "deepspeed_stage_3"

        r
   r   z/'{}' not found in registry. Available names: {}ú, Únoner   )ÚjoinÚsortedÚkeysÚKeyErrorÚformat)r   r	   r   r   Úerr_msgÚavailable_namess         r   Úgetz_StrategyRegistry.getT   sr   € ð �4‰<Ø˜‘:ˆDØ#�4˜
Ñ#Ñ: d¨=Ñ&9Ñ:Ð:àÐØˆNàCˆØŸ)™)¤F¨4¯9©9«;Ó$7Ó8ÒB¸FˆÜ�w—~‘~ d¨OÓ<Ó=Ð=r   c                 ó&   — | j                  |«       y)z(Removes the registered strategy by name.N)Úpop)r   r	   s     r   Úremovez_StrategyRegistry.removeg   s   € à�‰��r   c                 ó4   — t        | j                  «       «      S )z(Returns a list of registered strategies.)Úlistr$   ©r   s    r   Úavailable_strategiesz&_StrategyRegistry.available_strategiesk   s   € ä�D—I‘I“KÓ Ð r   c                 ó^   — dj                  dj                  | j                  «       «      «      S )NzRegistered Strategies: {}r    )r&   r"   r$   r/   s    r   Ú__str__z_StrategyRegistry.__str__o   s"   € Ø*×1Ñ1°$·)±)¸D¿I¹I»KÓ2HÓIÐIr   )NNF)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úboolr   r   r   r)   r,   r.   r0   r2   r   r   r   r   r      sµ   „ ñð6 (,Ø%)Øñ&àð&ð ˜8Ñ$ð&ð ˜c‘]ð	&ð
 ð&ð ð&ð 
ó&ðP ñ>˜ð > h¨s¡mð >¸sò >ó ð>ð$˜3ð  4ó ð! dó !ðJ˜ô Jr   r   N)Útypingr   r   r   Útyping_extensionsr   Údictr   r   r   r   Ú<module>r;      s    ð÷ +Ñ *å &ô]J˜õ ]Jr   