§
    “©ºjI  ã                   óB   — d dl mZmZmZ d dlmZ  G d„ de¦  «        ZdS )é    )Ú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dS )Ú_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)

    NFÚ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

        Nz`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    €€€út/root/private/project/pallet_detection_v2/.venv/lib/python3.11/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Ô 5�ÝÐA¸4ÐAÐAÑBÔBÐBà�4ˆ<ˆ< ˆ<ÝÐg ÐgÐgÐgÑhÔhÐhà!ˆØ-8Ð-D˜k˜kÈ"ˆˆ]Ñà)ˆˆ]Ñð	¥(ð 	­xð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ÐØ�;˜xÑ(Ô(Ð(àÐr   Údefaultc                 ó   — || v r| |         } |d         di |d         ¤ŽS |�|S d}d                      t          |                      ¦   «         ¦  «        ¦  «        pd}t          |                     ||¦  «        ¦  «        ‚)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   Nz/'{}' not found in registry. Available names: {}ú, Únoner   )ÚjoinÚsortedÚkeysÚKeyErrorÚformat)r   r	   r   r   Úerr_msgÚavailable_namess         r   Úgetz_StrategyRegistry.getT   sˆ   € ð �4ˆ<ˆ<Ø˜”:ˆDØ#�4˜
Ô#Ð:Ð: d¨=Ô&9Ð:Ð:Ð:àÐØˆNàCˆØŸ)š)¥F¨4¯9ª9©;¬;Ñ$7Ô$7Ñ8Ô8ÐB¸FˆÝ�w—~’~ d¨OÑ<Ô<Ñ=Ô=Ð=r   c                 ó0   — |                       |¦  «         dS )z(Removes the registered strategy by name.N)Úpop)r   r	   s     r   Úremovez_StrategyRegistry.removeg   s   € à�Š�‰Œˆˆˆr   c                 óD   — t          |                      ¦   «         ¦  «        S )z(Returns a list of registered strategies.)Úlistr$   ©r   s    r   Úavailable_strategiesz&_StrategyRegistry.available_strategiesk   s   € å�D—I’I‘K”KÑ Ô Ð r   c                 óv   — d                      d                     |                      ¦   «         ¦  «        ¦  «        S )NzRegistered Strategies: {}r    )r&   r"   r$   r/   s    r   Ú__str__z_StrategyRegistry.__str__o   s*   € Ø*×1Ò1°$·)²)¸D¿IºI¹K¼KÑ2HÔ2HÑIÔ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ð >ð >ð >ñ „Xð>ð$˜3ð  4ð ð ð ð ð! dð !ð !ð !ð !ðJ˜ð Jð Jð Jð Jð Jð Jr   r   N)Útypingr   r   r   Útyping_extensionsr   Údictr   r   r   r   ú<module>r;      s   ðð +Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à &Ð &Ð &Ð &Ð &Ð &ð]Jð ]Jð ]Jð ]Jð ]J˜ñ ]Jô ]Jð ]Jð ]Jð ]Jr   