Ë
    ÿÍ:j½D  ã            	       óŠ  — U d dl Z d dlmZmZmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZmZmZmZmZmZ d dlZd dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dl m!Z! d dl"m#Z# d dl$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/  ede0e1ef   ¬«      Z2dZ3dZ4e5e6d<    G d„ d«      Z7 G d„ de-«      Z8 G d„ d «      Z9d!ed"efd#„Z:d$eeef   d"e;eeejx                  f   ee0e1ef      f   fd%„Z=d&ejx                  d'e0e1ef   d"efd(„Z>d)e5d*ed"dfd+„Z?d$e@d"e5fd,„ZAd-ed"efd.„ZB eBej†                  «      e_C        y)/é    N)Ú	GeneratorÚIteratorÚMapping)Údeepcopy)ÚpartialÚwraps)Ú
MethodType)ÚAnyÚCallableÚOptionalÚTypeVarÚUnionÚoverload)Úis_overridden)Úapply_to_collection)ÚTensor)Únn)ÚOptimizedModule)Ú_IncompatibleKeys)Ú	Optimizer)Ú
DataLoader)Úoverride)Ú	Precision)ÚStrategy)Úmove_data_to_device)Ú_set_sampler_epoch)Ú_DeviceDtypeModuleMixin)ÚOptimizableÚT_destination)Úbound)Útraining_stepÚvalidation_stepÚ	test_stepÚpredict_stepFÚ_in_fabric_backwardc            	       ó    — e Zd Zddededeee      ddfd„Ze	defd„«       Z
deeef   fd„Zd	eeef   ddfd
„Zddee   defd„Zdedefd„Zy)Ú_FabricOptimizerNÚ	optimizerÚstrategyÚ	callbacksÚreturnc                 ó´   — || _         || _        |xs g | _        t        d|j                  j
                  z   | j                  |j                  fi «      | _        y)aˆ  FabricOptimizer is a thin wrapper around the :class:`~torch.optim.Optimizer` that delegates the optimizer
        step calls to the strategy.

        The underlying wrapped optimizer object can be accessed via the property :attr:`optimizer`.

        Args:
            optimizer: The optimizer to wrap
            strategy: Reference to the strategy for handling the optimizer step

        ÚFabricN)Ú
_optimizerÚ	_strategyÚ
_callbacksÚtypeÚ	__class__Ú__name__)Úselfr(   r)   r*   s       ún/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/lightning_fabric/wrappers.pyÚ__init__z_FabricOptimizer.__init__5   sO   € ð $ˆŒØ!ˆŒØ#š/ rˆŒä˜h¨×)<Ñ)<×)EÑ)EÑEÈÏÉÐXa×XkÑXkÐGlÐnpÓqˆ�ó    c                 ó   — | j                   S ©N)r.   ©r4   s    r5   r(   z_FabricOptimizer.optimizerF   s   € à�‰Ðr7   c                 óL   — | j                   j                  | j                  «      S r9   )r/   Úget_optimizer_stater(   r:   s    r5   Ú
state_dictz_FabricOptimizer.state_dictJ   s   € Ø�~‰~×1Ñ1°$·.±.ÓAÐAr7   r=   c                 ó:   — | j                   j                  |«       y r9   )r(   Úload_state_dict)r4   r=   s     r5   r?   z _FabricOptimizer.load_state_dictM   s   € Ø�‰×&Ñ& zÕ2r7   Úclosurec                 ó†  — |�d|ini }t        | j                  d«      r;t        | j                  j                  t        «      r| j                  j                  }n| j
                  } | j                  j                  |fi |¤Ž}| j                  D ]/  }t        |dd «      }t        |«      sŒ || j                  |¬«       Œ1 |S )Nr@   ÚmodelÚon_after_optimizer_step)r)   r(   )
Úhasattrr/   Ú
isinstancerB   r   r(   Úoptimizer_stepr0   ÚgetattrÚcallable)r4   r@   Úkwargsr(   ÚoutputÚcallbackÚhooks          r5   Ústepz_FabricOptimizer.stepP   s°   € Ø)0Ð)<�)˜WÑ%À"ˆÜ�4—>‘> 7Ô+´
¸4¿>¹>×;OÑ;OÔQ\Ô0]àŸ™×,Ñ,‰IàŸ™ˆIØ.�—‘×.Ñ.Øñ
àñ
ˆð Ÿ™ò 	CˆHÜ˜8Ð%>ÀÓEˆDÜ˜�~Ù˜dŸn™n¸	ÖBð	Cð ˆr7   Úitemc                 ó.   — t        | j                  |«      S r9   )rG   r.   ©r4   rN   s     r5   Ú__getattr__z_FabricOptimizer.__getattr__a   s   € Ü�t—‘¨Ó-Ð-r7   r9   )r3   Ú
__module__Ú__qualname__r   r   r   Úlistr   r6   Úpropertyr(   ÚdictÚstrr   r=   r?   r
   rM   rQ   © r7   r5   r'   r'   4   s®   „ ñr )ð r°xð rÈHÐUYÐZbÑUcÑLdð rÐptó rð" ð˜9ò ó ððB˜D  f Ñ-ó Bð3¨$¨s°F¨{Ñ*;ð 3Àó 3ñ˜H XÑ.ð ¸#ó ð". ð .¨ô .r7   r'   c                   óþ  ‡ — e Zd Z	 d"dej                  dedeej                     ddfˆ fd„Zedej                  fd„«       Z	e
ded	edefd
„«       Zedddœdedededefd„«       Zedddœdededeeef   fd„«       Ze
	 d#dee   dededeeeef      fd„«       Ze
	 d$deeef   ded	edefd„«       Zdeeef   ddfd„Zdedefd„Zdededefd„Zdedefd„Ze
dedefˆ fd„«       Ze
ded eddfˆ fd!„«       Zˆ xZ S )%Ú_FabricModuleNÚforward_moduler)   Úoriginal_moduler+   c                 óŠ   •— t         ‰| �  «        || _        |€|n|| _        || _        t        t        «      | _        d| _        y)a   The FabricModule is a thin wrapper around the :class:`torch.nn.Module` and handles precision / autocast
        automatically for the forward pass.

        The underlying wrapped module can be accessed via the property :attr:`module`.

        Args:
            forward_module: The module to wrap the ``forward`` method on.
            strategy: Reference to the strategy for handling precision etc.
            original_module: The original, unmodified module as passed into the
                :meth:`lightning_fabric.fabric.Fabric.setup` method. This is needed when attribute lookup
                on this wrapper should pass through to the original module.

        NT)	Úsuperr6   Ú_forward_moduleÚ_original_moduler/   ÚsetÚ_LIGHTNING_MODULE_STEP_METHODSÚ_forward_methodsÚ_fabric_module_initialized)r4   r[   r)   r\   r2   s       €r5   r6   z_FabricModule.__init__f   sD   ø€ ô  	‰ÑÔØ-ˆÔØ2AÐ2I¡ÈˆÔØ!ˆŒÜ #Ô$BÓ CˆÔØ*.ˆÕ'r7   c                 ó6   — | j                   xs | j                  S r9   )r`   r_   r:   s    r5   Úmodulez_FabricModule.module}   s   € à×$Ñ$Ò<¨×(<Ñ(<Ð<r7   ÚargsrI   c                 ó&  — | j                   j                  }|j                  ||f«      \  }}|j                  «       5   | j                  |i |¤Ž}ddd«       |j                  «      }t        |t        | j                  ¬«       |S # 1 sw Y   Œ8xY w)ziCasts all inputs to the right precision and handles autocast for operations in the module forward method.N©ÚdtypeÚfunction)	r/   Ú	precisionÚconvert_inputÚforward_contextr_   Úconvert_outputr   r   Ú_register_backward_hook)r4   rg   rI   rl   rJ   s        r5   Úforwardz_FabricModule.forward�   sŒ   € ð —N‘N×,Ñ,ˆ	Ø ×.Ñ.°°f¨~Ó>‰ˆˆfà×&Ñ&Ó(ñ 	;Ø)�T×)Ñ)¨4Ð:°6Ñ:ˆF÷	;ð ×)Ñ)¨&Ó1ˆä˜F¬&¸4×;WÑ;WÕXØˆ÷	;ð 	;ús   ½BÂB.)ÚprefixÚ	keep_varsÚdestinationrr   rs   c                 ó   — y r9   rX   ©r4   rt   rr   rs   s       r5   r=   z_FabricModule.state_dict�   s   € Øtwr7   c                 ó   — y r9   rX   )r4   rr   rs   s      r5   r=   z_FabricModule.state_dict’   s   € ØY\r7   c                 ó>   — | j                   j                  |||¬«      S )N)rt   rr   rs   )r`   r=   rv   s       r5   r=   z_FabricModule.state_dict•   s+   € ð ×$Ñ$×/Ñ/Ø#ØØð 0ó 
ð 	
r7   r=   Ústrictc                 ó@   —  | j                   j                  d||dœ|¤ŽS )N)r=   ry   rX   )r`   r?   )r4   r=   ry   rI   s       r5   r?   z_FabricModule.load_state_dictŸ   s)   € ð 5ˆt×$Ñ$×4Ñ4ÐdÀ
ÐSYÑdÐ]cÑdÐdr7   Úmethodc           	      ó²  — t        |t        t        f«      s!t        dt	        |«      j
                  › �«      ‚t        |t        «      r|n|j
                  }|dk(  rt        d«      ‚t        t        | j                  |d«      t        «      s2t        d|› dt	        | j                  «      j
                  › d|› d�«      ‚| j                  j                  |«       y)	z]Mark a method as a 'forward' method to prevent it bypassing the strategy wrapper (e.g., DDP).z(Expected a method or a string, but got: rq   z>You cannot mark the forward method itself as a forward method.NzYou marked 'z' as a forward method, but `ú.z$` does not exist or is not a method.)rE   r	   rW   Ú	TypeErrorr1   r3   Ú
ValueErrorrG   r`   ÚAttributeErrorrc   Úadd)r4   r{   Únames      r5   Úmark_forward_methodz!_FabricModule.mark_forward_method¥   sÇ   € ä˜&¤:¬sÐ"3Ô4ÜÐFÄtÈFÃ|×G\ÑG\ÐF]Ð^Ó_Ð_Ü# F¬CÔ0‰v°f·o±oˆØ�9ÒÜÐ]Ó^Ð^Üœ' $×"7Ñ"7¸¸tÓDÄjÔQÜ Ø˜t˜fÐ$@ÄÀd×F[ÑF[ÓA\×AeÑAeÐ@fÐfgÐhlÐgmð n-ð .óð ð 	×Ñ×!Ñ! $Õ'r7   Úmethod_namec                 ó®   ‡ ‡‡‡— ‰dk7  sJ ‚‰ j                   j                  Šdt        dt        dt        fˆˆˆ fd„Šdt        dt        dt        fˆ ˆfd„}|S )Nrq   rg   rI   r+   c                  ób   •— ‰‰j                   _        t        ‰j                   ‰«      } || i |¤ŽS r9   )r`   rq   rG   )rg   rI   r{   r„   Úoriginal_forwardr4   s      €€€r5   Úwrapped_forwardzC_FabricModule._redirection_through_forward.<locals>.wrapped_forward·   s5   ø€ ð -=ˆD×!Ñ!Ô)ä˜T×2Ñ2°KÓ@ˆFÙ˜4Ð* 6Ñ*Ð*r7   c                  óJ   •— ‰‰j                   _         ‰j                  | i |¤ŽS r9   )r`   rq   )rg   rI   r4   rˆ   s     €€r5   Úcall_forward_modulezG_FabricModule._redirection_through_forward.<locals>.call_forward_moduleÂ   s'   ø€ à,;ˆD×!Ñ!Ô)Ø�4—<‘< Ð0¨Ñ0Ð0r7   )r`   rq   r
   )r4   r„   rŠ   r‡   rˆ   s   `` @@r5   Ú_redirection_through_forwardz*_FabricModule._redirection_through_forward³   s_   û€ Ø˜iÒ'Ð'Ð'Ø×0Ñ0×8Ñ8Ðð	+¤3ð 	+´#ð 	+¼#÷ 	+ð	1¤sð 	1´cð 	1¼cö 	1ð
 #Ð"r7   r‚   c                 ó�   ‡ ‡‡‡‡— dŠdt         dt         ddfˆfd„Št        ‰«      dt         dt         dt         fˆˆˆˆˆ fd	„«       }|S )
zŸTracks whether any submodule in ``self._original_module`` was called during the execution of ``method`` by
        registering forward hooks on all submodules.FÚ_Ú__r+   Nc                  ó
   •— dŠy )NTrX   )r�   rŽ   Úmodule_calleds     €r5   rL   zA_FabricModule._wrap_method_with_module_call_tracker.<locals>.hookÎ   s   ø€ à ‰Mr7   rg   rI   c            	      ó0  •— g }‰
j                   j                  «       D ]"  }|j                  |j                  ‰«      «       Œ$  ‰| i |¤Ž}‰r2t	        dt        ‰
j                   «      j                  › d‰	› d‰	›d�«      ‚|D ]  }|j                  «        Œ |S )NzYou are calling the method `r}   z ()` from outside the model. To avoid issues with the currently selected strategy, explicitly mark it as a forward method with `fabric_model.mark_forward_method(z)` after `fabric.setup()`.)r`   ÚmodulesÚappendÚregister_forward_hookÚRuntimeErrorr1   r3   Úremove)rg   rI   Úhandlesrf   rJ   ÚhandlerL   r{   r�   r‚   r4   s         €€€€€r5   Ú_wrapped_methodzL_FabricModule._wrap_method_with_module_call_tracker.<locals>._wrapped_methodÒ   s¶   ø€ àˆGØ×/Ñ/×7Ñ7Ó9ò C�Ø—‘˜v×;Ñ;¸DÓAÕBðCñ ˜TÐ, VÑ,ˆFáÜ"Ø2´4¸×8MÑ8MÓ3N×3WÑ3WÐ2XÐXYÐZ^ÐY_ð `NàNRÈXÐUoðqóð ð
 "ò  �Ø—‘•ð àˆMr7   )r
   r   )r4   r{   r‚   r™   rL   r�   s   ``` @@r5   Ú%_wrap_method_with_module_call_trackerz3_FabricModule._wrap_method_with_module_call_trackerÉ   s^   ü€ ð ˆð	!”Sð 	!¤ð 	!¨õ 	!ô 
ˆv‹ð	¤3ð 	´#ð 	¼#÷ 	ð 	ó 
ð	ð" Ðr7   Útensorc                 óÎ   ‡ — |j                   s|S t        d‰ j                  t        ¬«      }t	        ˆ fd„dD «       «      }t        t        |xs |«      }|j                  |«       |S )NÚbackward©Úparentc              3   ój   •K  — | ]*  }t        |‰j                  j                  t        ¬ «      –— Œ, y­w)rž   N)r   r/   rl   r   )Ú.0r{   r4   s     €r5   ú	<genexpr>z8_FabricModule._register_backward_hook.<locals>.<genexpr>ë   s/   øè ø€ ò !
àô ˜& $§.¡.×":Ñ":Ä9×MÐMñ!
ùs   ƒ03)Úpre_backwardr�   Úpost_backward)Úrequires_gradr   r/   r   Úanyr   Ú_backward_hookÚregister_hook)r4   r›   Ústrategy_requiresÚprecision_requiresrL   s   `    r5   rp   z%_FabricModule._register_backward_hookæ   sd   ø€ Ø×#Ò#ØˆMä)¨*°d·n±nÌXÔVÐÜ ó !
àGô!
ó 
Ðô ”~Ð(9Ò(OÐ=OÓQˆØ×Ñ˜TÔ"Øˆr7   rN   c                 óv  •— |dk7  r8|| j                   v r*| j                  | j                  k7  r| j                  |«      S 	 t        ‰| �  |«      S # t        $ r` t        ‰| �  d«      }t        ||«      }t        j                  |«      r+| j                  | j                  k7  r| j                  ||«      }|cY S w xY w)Nrc   r`   )rc   r_   r`   r‹   r^   rQ   r€   rG   ÚinspectÚismethodrš   )r4   rN   r\   Úattrr2   s       €r5   rQ   z_FabricModule.__getattr__ó   s½   ø€ ð Ð&Ò&Ø˜×-Ñ-Ñ-Ø×$Ñ$¨×(=Ñ(=Ò=ð ×4Ñ4°TÓ:Ð:ð	ô ‘7Ñ& tÓ,Ð,øÜò 	ä#™gÑ1Ð2DÓEˆOÜ˜?¨DÓ1ˆDä×Ñ Ô%¨$×*>Ñ*>À$×BWÑBWÒ*WØ×AÑAÀ$ÈÓM�ØŠKð	ús   Á A ÁA&B8Â7B8Úvaluec                 óô   •— t        | dd«      st        ‰| �	  ||«       y | j                  }t	        ||«      }|t        | «      v }|s|st        |||«       y |rt        |||«       |rt        ‰| �	  ||«       y y )Nrd   F)rG   r^   Ú__setattr__r`   rD   ÚdirÚsetattr)r4   r‚   r¯   r\   Úoriginal_has_attrÚfabric_has_attrr2   s         €r5   r±   z_FabricModule.__setattr__
  sˆ   ø€ ä�tÐ9¸5ÔAÜ‰GÑ  eÔ,Øð ×/Ñ/ˆÜ# O°TÓ:Ðð ¤# d£)Ð+ˆá!¡_Ü�O T¨5Ô1Øñ
 Ü�O T¨5Ô1áÜ‰GÑ  eÕ,ð r7   r9   )NÚ F)T)!r3   rR   rS   r   ÚModuler   r   r6   rU   rf   r   r
   rq   r   r   rW   Úboolr=   rV   r   r   r?   r   r	   rƒ   r   r‹   rš   r   rp   rQ   r±   Ú__classcell__)r2   s   @r5   rZ   rZ   e   s  ø„ àdhñ/Ø Ÿi™ið/Ø3;ð/ØNVÐWY×W`ÑW`ÑNað/à	õ/ð. ð=˜Ÿ	™	ò =ó ð=ð ð˜Sð ¨Cð °Cò ó ðð ØFIÐ]`Òw¨ÐwÀÐwÐVZÐwÐerÒwó ØwàØ*-ÀÒ\ CÐ\¸$Ð\ÈÈcÐSVÈhÉÒ\ó Ø\àà_dñ
Ø# MÑ2ð
ØCFð
ØX\ð
à	�$�s˜C�x‘.Ñ	!ò
ó ð
ð à<@ñeØ! # s (Ñ+ðeØ59ðeØLOðeà	òeó ðeð
(¨%°
¸C°Ñ*@ð (ÀTó (ð#¸ð #Àó #ð,¸Hð ÈCð ÐT\ó ð:¨fð ¸ó ð ð ð ¨ô ó ðð, ð- ð -¨Cð -°Dô -ó ô-r7   rZ   c                   ó    — e Zd Zd	dedeej                     ddfd„Zedeej                     fd„«       Zde	fd„Z
deee   eeddf   f   fd„Zy)
Ú_FabricDataLoaderNÚ
dataloaderÚdevicer+   c                 óx   — | j                   j                  |j                   «       || _        || _        d| _        y)a¾  The FabricDataLoader is a wrapper for the :class:`~torch.utils.data.DataLoader`. It moves the data to the
        device automatically if the device is specified.

        Args:
            dataloader: The dataloader to wrap
            device: The device to which the data should be moved. By default the device is `None` and no data
                transfers will be made (identical behavior as :class:`~torch.utils.data.DataLoader`).

        r   N)Ú__dict__ÚupdateÚ_dataloaderÚ_deviceÚ_num_iter_calls)r4   r¼   r½   s      r5   r6   z_FabricDataLoader.__init__&  s3   € ð 	�‰×Ñ˜Z×0Ñ0Ô1Ø%ˆÔØˆŒØ ˆÕr7   c                 ó   — | j                   S r9   )rÂ   r:   s    r5   r½   z_FabricDataLoader.device5  s   € à�|‰|Ðr7   c                 ó,   — t        | j                  «      S r9   )ÚlenrÁ   r:   s    r5   Ú__len__z_FabricDataLoader.__len__9  s   € Ü�4×#Ñ#Ó$Ð$r7   c              #   ó   K  — t        | j                  | j                  «       | xj                  dz  c_        | j                  €t	        | j                  «      E d {  –—†  y | j                  D ]  }t        || j                  «      –— Œ y 7 Œ/­w)Né   )r   rÁ   rÃ   rÂ   Úiterr   rP   s     r5   Ú__iter__z_FabricDataLoader.__iter__<  sx   è ø€ ô 	˜4×+Ñ+¨T×-AÑ-AÔBØ×Ò Ñ!Õà�<‰<ÐÜ˜D×,Ñ,Ó-×-Ñ-à×(Ñ(ò >�Ü)¨$°·±Ó=Ó=ñ>ð .ús   ‚ABÁBÁ0Br9   )r3   rR   rS   r   r   Útorchr½   r6   rU   ÚintrÇ   r   r   r
   r   rË   rX   r7   r5   r»   r»   %  s{   „ ñ! :ð !°xÀÇÁÑ7Mð !ÐY]ó !ð ð˜ §¡Ñ.ò ó ðð%˜ó %ð>˜% ¨¡¨y¸¸dÀD¸Ñ/IÐ IÑJô >r7   r»   Ú
collectionr+   c                 óø   — dt         t        t        t        f   dt         t        j
                  t        t        f   fd„}t        t        t        g}|j                  t        «       t        | t        |«      |¬«      S )NÚobjr+   c                 óâ   — t        t        | «      d   x}t        «      rt        |j                  «      d   S t        | t        «      r| j
                  S t        | t        «      r| j                  S | S ©Nr   )rE   Ú_unwrap_compiledrZ   r_   r'   r(   r»   rÁ   )rÐ   Ú	unwrappeds     r5   Ú_unwrapz _unwrap_objects.<locals>._unwrapK  sc   € ô Ô#3°CÓ#8¸Ñ#;Ð;�i¼]ÔKÜ# I×$=Ñ$=Ó>¸qÑAÐAÜ�cÔ+Ô,Ø—=‘=Ð Ü�cÔ,Ô-Ø—?‘?Ð"Øˆ
r7   ri   )r   rZ   r'   r»   r   r·   r   r   r“   r   r   Útuple)rÎ   rÕ   Útypess      r5   Ú_unwrap_objectsrØ   J  sd   € ð	Ü”=Ô"2Ô4EÐEÑFð	ä	Œr�y‰yœ)¤ZÐ/Ñ	0ó	ô Ô,Ô.?Ð@€EØ	‡L�L”Ô!ä˜z´°u³ÈÔPÐPr7   rÐ   c                 óz   — t        | t        «      r(t        | dd«      x}€t        d«      ‚| j                  |fS | dfS )z¯Removes the :class:`torch._dynamo.OptimizedModule` around the object if it is wrapped.

    Use this function before instance checks against e.g. :class:`_FabricModule`.

    Ú_compile_kwargsNz…Failed to determine the arguments that were used to compile the module. Make sure to import lightning before `torch.compile` is used.)rE   r   rG   r•   Ú	_orig_mod)rÐ   Úcompile_kwargss     r5   rÓ   rÓ   \  sP   € ô �#”Ô'Ü% cÐ+<¸dÓCÐCˆNÐLÜð=óð ð �}‰}˜nÐ,Ð,Ø�ˆ9Ðr7   rf   rÜ   c                 ó.   — t        j                  | fi |¤ŽS r9   )rÌ   Úcompile)rf   rÜ   s     r5   Ú_to_compiledrß   l  s   € Ü�=‰=˜Ñ2 >Ñ2Ð2r7   Úrequires_backwardr�   c                 ó,   — | rt         st        d«      ‚y y )NzwThe current strategy and precision selection requires you to call `fabric.backward(loss)` instead of `loss.backward()`.)r%   r•   )rà   r�   s     r5   r§   r§   p  s"   € ÙÕ!4Üð-ó
ð 	
ð "5Ðr7   c                 óT   — t        | «      \  } }t        | t        t        t        f«      S )aZ  Checks if an object was set up by Fabric.

    A :class:`~torch.nn.Module` may be wrapped by a :class:`_FabricModule`, a :class:`~torch.optim.Optimizer`
    may be wrapped by a :class:`_FabricOptimizer`, or a :class:`~torch.utils.data.DataLoader` may be wrapped by
    :class:`_FabricDataLoader`.

    Args:
        obj: The object to test.

    )rÓ   rE   rZ   r'   r»   )rÐ   r�   s     r5   Ú
is_wrappedrã   x  s(   € ô ˜cÓ"�F€CˆÜ�cœMÔ+;Ô=NÐOÓPÐPr7   Ú
compile_fnc                 óT   ‡ — t        ‰ «      dt        dt        dt        fˆ fd„«       }|S )aZ  Wraps the ``torch.compile`` function and captures the compile arguments.

    We extract the compile arguments so that we can reapply ``torch.compile`` in ``Fabric.setup()`` with the
    same arguments as the user passed to the original call. The arguments get stored in a dictionary
    ``_compile_kwargs`` on the returned compiled module.

    rg   rI   r+   c                  ó’   •— | rt        | d   t        j                  «      s ‰| i |¤ŽS | d   } ‰|fi |¤Ž}t        |«      |_        |S rÒ   )rE   r   r·   r   rÚ   )rg   rI   rB   Úcompiled_modelrä   s       €r5   Ú_capturez)_capture_compile_kwargs.<locals>._capture’  sR   ø€ áœ: d¨1¡g¬r¯y©yÔ9á˜tÐ. vÑ.Ð.à�Q‘ˆÙ# EÑ4¨VÑ4ˆÜ)1°&Ó)9ˆÔ&ØÐr7   )r   r
   )rä   rè   s   ` r5   Ú_capture_compile_kwargsré   ‡  s8   ø€ ô ˆ:Óðœð ¤sð ¬sô ó ðð €Or7   )Dr¬   Úcollections.abcr   r   r   Úcopyr   Ú	functoolsr   r   r×   r	   Útypingr
   r   r   r   r   r   rÌ   Úlightning_utilitiesr   Ú#lightning_utilities.core.apply_funcr   r   r   Útorch._dynamor   Útorch.nn.modules.moduler   Útorch.optimr   Útorch.utils.datar   Útyping_extensionsr   Úlightning_fabric.pluginsr   Úlightning_fabric.strategiesr   Úlightning_fabric.utilitiesr   Úlightning_fabric.utilities.datar   Ú-lightning_fabric.utilities.device_dtype_mixinr   Ú lightning_fabric.utilities.typesr   rV   rW   r   rb   r%   r¸   Ú__annotations__r'   rZ   r»   rØ   rÖ   r·   rÓ   rß   r§   Úobjectrã   ré   rÞ   rX   r7   r5   ú<module>rý      sx  ðô ß 8Ñ 8Ý ß $Ý ÷÷ ó Ý -Ý CÝ Ý Ý )Ý 5Ý !Ý 'Ý &å .Ý 0Ý :Ý >Ý QÝ 8á˜¨t°C¸°H©~Ô>€Ø!bÐ à!Ð �TÓ !÷..ñ ..ôb}-Ð+ô }-÷@">ñ ">ðJQ ð Q¨ó Qð$˜%  _Ð 4Ñ5ð ¸%ÀÀcÈ2Ï9É9ÀnÑ@UÐW_Ð`dÐehÐjmÐemÑ`nÑWoÐ@oÑ:pó ð 3˜Ÿ™ð 3°D¸¸c¸±Nð 3Àó 3ð
 dð 
°ð 
¸ó 
ðQ�Fð Q˜tó Qð¨ð °Xó ñ2 (¨¯©Ó6€…r7   