ó
    Eñi<P  ã                   ó  • S SK r S SKrS SKrS SKrS SKJr  S SK Jr  S SKJrJ	r	  S SK
Jr  S SKJr  S SKrS SKrS SKJr  S SKJr  S	S
KJr  S	SKJr  S	SKJr  SSKJr  SSKJr  SSK J!r!J"r"J#r#J$r$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+  \" \,5      r-\$" 5       (       a	  S SK.J/s  J0r1  S\Rd                  Rf                  S\44S jr5S\Rd                  Rf                  S\44S jr6S\Rd                  Rf                  S\44S jr7S\Rd                  Rf                  S\44S jr8S\Rd                  Rf                  S\Rd                  Rf                  4S jr9S\Rd                  Rf                  4S jr:S\Rd                  Rf                  S\44S jr; S6S\4S\4S \44S! jjr<S" r=S#\>4S$ jr?S7S%\4S&\44S' jjr@\"" S(5      (       a  \R‚                  O\R^                  rB\BR†                  Rˆ                  \RŠ                  \\RŒ                  /rG\"" S)5      (       a%  \GR‘                  \R’                  R”                  5        S8S* jrKS+ rLS, rMS8S-\\N   S\44S. jjrOS\N4S/ jrPS0 rQS1 rRS2\S4S3 jrTS9S\Rd                  Rf                  S4\4S\U\Rd                  Rf                     4S5 jjrVg):é    N)Úencode)ÚOrderedDict)ÚpartialÚreduce)Ú
MethodType)ÚOptional)ÚVersion)Ú	save_fileé   )Úwrite_basic_config)Ú
get_logger)ÚPartialStateé   )ÚFSDP_PYTORCH_VERSION)ÚDistributedType)Úis_deepspeed_availableÚis_numpy_availableÚis_torch_distributed_availableÚis_torch_xla_availableÚis_weights_only_available)Úid_tensor_storage)Úconvert_model)Úis_torch_versionÚmoduleÚreturnc                 óŠ   • [        [        S5      (       d  g[        U [        R                  R                  R
                  5      $ )z<
Check whether the module was compiled with torch.compile()
Ú_dynamoF)ÚhasattrÚtorchÚ
isinstancer   Ú
eval_frameÚOptimizedModule©r   s    ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/accelerate/utils/other.pyÚis_compiled_moduler%   6   s1   € ô ”5˜)×$Ñ$Øä�fœeŸm™m×6Ñ6×FÑFÓGÐGó    c                 óê   • [        [        S5      (       d  gU R                  (       aL  U R                  5        H8  n[	        U[        R
                  R                  R                  5      (       d  M8    g   g)zT
Check whether the module has submodules that were compiled with `torch.compile()`.
r   FT)r   r   Ú_modulesÚmodulesr    r   r!   r"   ©r   Ú	submodules     r$   Úhas_compiled_regionsr,   @   sQ   € ô ”5˜)×$Ñ$Øà‡‡ØŸ™Ö)ˆIÜ˜)¤U§]¡]×%=Ñ%=×%MÑ%M×NÓNÙñ *ð r&   c                 ó®   ^ • [        T [        R                  R                  5      =(       a*    [	        T 5      S:„  =(       a    [        U 4S jT  5       5      $ )zÇ
Check whether the module is a repeated block, i.e. `torch.nn.ModuleList` with all children of the same class. This
is useful to determine whether we should apply regional compilation to the module.
r   c              3   óV   >#   • U  H  n[        UTS    R                  5      v •  M      g7f)r   N)r    Ú	__class__)Ú.0Úmr   s     €r$   Ú	<genexpr>Ú%is_repeated_blocks.<locals>.<genexpr>X   s%   øé € ÐCºF°q”
˜1˜f Q™i×1Ñ1×2Ð2ºFùs   ƒ&))r    r   ÚnnÚ
ModuleListÚlenÚallr#   s   `r$   Úis_repeated_blocksr8   O   sC   ø€ ô 	�6œ5Ÿ8™8×.Ñ.Ó/÷ 	DÜ�‹K˜!‰O÷	DäÔC¹FÓCÓCðr&   c                 óx   • U R                   (       a)  U R                  5        H  n[        U5      (       d  M    g   g)zí
Check whether the module has repeated blocks, i.e. `torch.nn.ModuleList` with all children of the same class, at
any level of the module hierarchy. This is useful to determine whether we should apply regional compilation to the
module.
TF)r(   r)   r8   r*   s     r$   Úhas_repeated_blocksr:   \   s/   € ð ‡‡ØŸ™Ö)ˆIÜ! )×,Ó,Ùñ *ð r&   c                 óÎ   ^• S[         R                  R                  S[         R                  R                  4U4S jjmT" U 40 UD6nSUR                  ;  a  XR                  S'   U$ )aÃ  
Performs regional compilation where we target repeated blocks of the same class and compile them sequentially to
hit the compiler's cache. For example, in `GPT2LMHeadModel`, the repeated block/class is `GPT2Block`, and can be
accessed as `model.transformer.h[0]`. The rest of the model (e.g. model.lm_head) is compiled separately.

This allows us to speed up the compilation overhead / cold start of models like LLMs and Transformers in general.
See https://pytorch.org/tutorials/recipes/regional_compilation.html for more details.

Args:
    module (`torch.nn.Module`):
        The model to compile.
    **compile_kwargs:
        Additional keyword arguments to pass to `torch.compile()`.

Returns:
    `torch.nn.Module`: A new instance of the model with some compiled regions.

Example:
```python
>>> from accelerate.utils import compile_regions
>>> from transformers import AutoModelForCausalLM

>>> model = AutoModelForCausalLM.from_pretrained("gpt2")
>>> compiled_model = compile_regions(model, mode="reduce-overhead")
>>> compiled_model.transformer.h[0]
OptimizedModule(
    (_orig_mod): GPT2Block(
            (ln_1): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
            (attn): GPT2Attention(
            (c_attn): Conv1D(nf=2304, nx=768)
            (c_proj): Conv1D(nf=768, nx=768)
            (attn_dropout): Dropout(p=0.1, inplace=False)
            (resid_dropout): Dropout(p=0.1, inplace=False)
        )
        (ln_2): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
        (mlp): GPT2MLP(
            (c_fc): Conv1D(nf=3072, nx=768)
            (c_proj): Conv1D(nf=768, nx=3072)
            (act): NewGELUActivation()
            (dropout): Dropout(p=0.1, inplace=False)
        )
    )
)
```
r   r   c           	      ó  >• [        U 5      (       aO  [        R                  R                  5       nU  H)  nUR	                  [        R
                  " U40 UD65        M+     U$ [        U 5      (       a…  U R                  R                  U R                  5      nUR                  R                  U R                  5        0 Ul        U R                  5        H  u  pCUR                  UT" U40 UD65        M      U$ [        R
                  " U 40 UD6nU$ ©N)r8   r   r4   r5   ÚappendÚcompiler:   r/   Ú__new__Ú__dict__Úupdater(   Únamed_childrenÚ
add_module)r   Úcompile_kwargsÚ
new_moduler+   ÚnameÚ_compile_regionss        €r$   rH   Ú)compile_regions.<locals>._compile_regions™   sê   ø€ Ü˜f×%Ñ%ÜŸ™×,Ñ,Ó.ˆJÛ#�	Ø×!Ñ!¤%§-¢-°	Ñ"L¸^Ñ"LÖMñ $ð Ðô ! ×(Ñ(Ø×)Ñ)×1Ñ1°&×2BÑ2BÓCˆJØ×Ñ×&Ñ& v§¡Ô7Ø"$ˆJÔØ#)×#8Ñ#8Ö#:‘�Ø×%Ñ% dÑ,<¸YÑ,YÈ.Ñ,YÖZñ $;ð
 Ðô Ÿš vÑ@°Ñ@ˆJàÐr&   Ú	_orig_mod)r   r4   ÚModulerA   )r   rE   rF   rH   s      @r$   Úcompile_regionsrL   j   sZ   ø€ ð^¤§¡§¡ð ÄuÇxÁxÇÁ÷ ñ  " &Ñ;¨NÑ;€Jà˜*×-Ñ-Ó-à+1×Ñ˜KÑ(àÐr&   c                 óè   • [        U 5      (       a  U  H  nUR                  " S0 UD6  M     g[        U 5      (       a$  U R                  5        H  n[	        U40 UD6  M     gU R                  " S0 UD6  g)aõ  
Performs regional compilation the same way as `compile_regions`, but specifically for `DeepSpeedEngine.module`.
Since the model is wrapped in a `DeepSpeedEngine` and has many added hooks, offloaded parameters, etc that
`torch.compile(...)` interferes with, version of trgional compilation uses the inplace `module.compile()` method
instead.

Args:
    module (`torch.nn.Module`):
        The model to compile.
    **compile_kwargs:
        Additional keyword arguments to pass to `module.compile()`.
N© )r8   r?   r:   ÚchildrenÚcompile_regions_deepspeed)r   rE   r+   Úchilds       r$   rP   rP   ²   sd   € ô ˜&×!Ñ!ÛˆIØ×ÒÑ/ Ô/ò  ä	˜V×	$Ñ	$Ø—_‘_Ö&ˆEÜ% eÑ>¨~Ô>ò 'ð 	�ŠÑ(˜Ó(r&   Úmodelc                 ó†   ^• [        SS5      (       a  SSKJm  OSSKJm  [	        U4S jU R                  5        5       5      $ )z®
Check if the model has DTensor parameters.

Args:
    model (`torch.nn.Module`):
        The model to check.

Returns:
    `bool`: Whether the model has DTensor parameters.
ú>=z2.5.0r   )ÚDTensorc              3   ó<   >#   • U  H  n[        UT5      v •  M     g 7fr=   )r    )r0   ÚprU   s     €r$   r2   Ú$model_has_dtensor.<locals>.<genexpr>Û   s   øé € ÐBÒ/A¨!Œz˜!˜W×%Ð%Ò/Aùs   ƒ)r   Útorch.distributed.tensorrU   Útorch.distributed._tensorÚanyÚ
parameters)rR   rU   s    @r$   Úmodel_has_dtensorr]   Ê   s4   ø€ ô ˜˜g×&Ñ&Þ4õ 	6äÔB¨u×/?Ñ/?Ô/AÓBÓBÐBr&   Úkeep_fp32_wrapperÚkeep_torch_compileÚ	recursivec                 óÔ  ^• [         R                  R                  R                  [         R                  R                  4n[        U 5      n[        U 5      nSnU(       a  U nU R                  n O(U(       a!  SU R                  ;   a  U nU R                  S   n [        5       (       a  SSK
Jn  XH4-  n[        S[        5      (       a  [        5       (       a  SSKJn	  XI4-  n[#        X5      (       a  U R$                  n [#        X5      (       a  M  U(       a  U4S jmT" U 5      n U(       d�  U R&                  n
U R                  R)                  SS5      nUbF  [+        U
S	5      (       a%  U
R,                  n
X«:X  a  O[+        U
S	5      (       a  M%  [/        X 5      U l        [1        U S
S5      (       a
  [3        U SS9  U(       a+  Ub(  U(       a
  Xl        Un U $ U(       a  XR                  S'   Un U $ )a_  
Extract a model from its distributed containers.

Args:
    model (`torch.nn.Module`):
        The model to extract.
    keep_fp32_wrapper (`bool`, *optional*):
        Whether to remove mixed precision hooks from the model.
    keep_torch_compile (`bool`, *optional*):
        Whether to unwrap compiled model.
    recursive (`bool`, *optional*, defaults to `False`):
        Whether to recursively extract all cases of `module.module` from `model` as well as unwrap child sublayers
        recursively, not just the top-level distributed containers.

Returns:
    `torch.nn.Module`: The extracted model.
NrJ   r   )ÚDeepSpeedEnginerT   )ÚFullyShardedDataParallelc                 óª   >• [        U S5      (       a  T" U R                  5      nOU nUR                  5        H  u  p#[        XT" U5      5        M     U$ )Nr   )r   r   rC   Úsetattr)r   Úunwrapped_modulerG   rQ   Ú_recursive_unwraps       €r$   rg   Ú6extract_model_from_parallel.<locals>._recursive_unwrap  sT   ø€ ô �v˜x×(Ñ(Ù#4°V·]±]Ó#CÑ à#)Ð à/×>Ñ>Ö@‘�ÜÐ(Ñ0AÀ%Ó0HÖIñ  Aà#Ð#r&   Ú_original_forwardÚ__wrapped__Ú _converted_to_transformer_engineF)Úto_transformer_engine)r   r4   ÚparallelÚDistributedDataParallelÚDataParallelr%   r,   rJ   rA   r   Ú	deepspeedrb   r   r   r   Ú2torch.distributed.fsdp.fully_sharded_data_parallelrc   r    r   ÚforwardÚpopr   rj   r   Úgetattrr   )rR   r^   r_   r`   ÚoptionsÚis_compiledÚhas_compiledÚcompiled_modelrb   ÚFSDPrr   Úoriginal_forwardrg   s               @r$   Úextract_model_from_parallelr{   Þ   s£  ø€ ô( �x‰x× Ñ ×8Ñ8¼%¿(¹(×:OÑ:OÐP€Gä$ UÓ+€KÜ'¨Ó.€Là€NÞØˆØ—‘‰Þ	à˜%Ÿ.™.Ó(Ø"ˆNØ—N‘N ;Ñ/ˆEä×ÑÝ-àÐ%Ñ%ˆä˜Ô2×3Ñ3Ô8V×8XÑ8XÝgà�7Ñˆä
�U×
$Ñ
$Ø—‘ˆô �U×
$Ó
$ö õ
	$ñ " %Ó(ˆæØ—-‘-ˆØ Ÿ>™>×-Ñ-Ð.AÀ4ÓHÐØÑ'Ü˜' =×1Ñ1Ø!×-Ñ-�ØÓ.Øô ˜' =×1Ó1ô ' wÓ6ˆEŒMÜ�5Ð<¸e×DÑDÜ˜%°uÒ=æ˜nÑ8ÞØ',Ô$Ø"ˆEð
 €Lö	 Ø38×#Ñ# KÑ0Ø"ˆEà€Lr&   c                  ó4   • [        5       R                  5         g)z÷
Introduces a blocking point in the script, making sure all processes have reached this point before continuing.

<Tip warning={true}>

Make sure all processes will reach this instruction otherwise one of your processes will hang forever.

</Tip>
N)r   Úwait_for_everyonerN   r&   r$   r}   r}   6  s   € ô ƒN×$Ñ$Õ&r&   Ú
state_dictc           	      ó  • [         R                  " [        5      nU R                  5        H9  u  p#[	        U[
        5      (       a  M  U[        U5         R                  U5        M;     UR                  5        VVs0 s H  u  pE[        U5      S:”  d  M  XE_M     nnn[        5       nUR                  5        H>  nU Vs/ s H  o"U ;   d  M
  UPM     nnUR                  USS 5        USS  H  nX	 M     M@     [        U5      S:”  a  [        R                  SU S35        U R                  5        V	V
s0 s H7  u  pšU	[	        U
[        R                  5      (       a  U
R!                  5       OU
_M9     n n	n
U $ s  snnf s  snf s  sn
n	f )zœ
Cleans the state dictionary from a model and removes tensor aliasing if present.

Args:
    state_dict (`dict`):
        The state dictionary from a model
r   Nr   zRemoved shared tensor zk while saving. This should be OK, but check by verifying that you don't receive any warning while reloading)ÚcollectionsÚdefaultdictÚlistÚitemsr    Ústrr   r>   r6   ÚsetÚvaluesrB   ÚloggerÚwarningr   ÚTensorÚ
contiguous)r~   ÚptrsrG   ÚtensorÚptrÚnamesÚshared_ptrsÚ
warn_namesÚfound_namesÚkÚvs              r$   Ú clean_state_dict_for_safetensorsr”   C  sa  € ô ×"Ò"¤4Ó(€Dà"×(Ñ(Ö*‰ˆÜ˜&¤#×&Ó&ØÔ" 6Ó*Ñ+×2Ñ2°4Ö8ñ +ð
 15·
±
´ÔO²¡* #ÄÀEÃ
ÈQÁ“:�3’:±€KÑOÜ“€JØ×#Ñ#Ö%ˆñ ).ÓDª ¸Ñ1C—t©ˆÐDØ×Ñ˜+ a b˜/Ô*Ø  “OˆDØÒ ó $ñ &ô ˆ:ƒ˜ÓÜ�‰Ø$ Z Lð  1\ð  ]ô	
ð Wa×VfÑVfÔVhÔiÒVhÉdÈa�!¤z°!´U·\±\×'BÑ'B�Q—\‘\”^ÈÒIÑVh€JÑiØÐùó# Pùò Eùó js   Á;E7ÂE7Â>	E=ÃE=Ä4>FÚsave_on_each_nodeÚsafe_serializationc                 ó²  • [        5       R                  [        R                  :X  a  [        R
                  " U 5      n U(       a1  [        [        SS0S9n[        U [        5      (       a  [        U 5      n O[        R                  n[        5       R                  (       a  U(       d	  U" X5        g[        5       R                  (       a  U(       a	  U" X5        ggg)aÉ  
Save the data to disk. Use in place of `torch.save()`.

Args:
    obj:
        The data to save
    f:
        The file (or file-like object) to use to save the data
    save_on_each_node (`bool`, *optional*, defaults to `False`):
        Whether to only save on the global main process
    safe_serialization (`bool`, *optional*, defaults to `False`):
        Whether to save `obj` using `safetensors` or the traditional PyTorch way (that uses `pickle`).
ÚformatÚpt)ÚmetadataN)r   Údistributed_typer   ÚXLAÚxmÚ_maybe_convert_to_cpur   Úsafe_save_filer    r   r”   r   ÚsaveÚis_main_processÚis_local_main_process)ÚobjÚfr•   r–   Ú	save_funcs        r$   r    r    f  s”   € ô$ ƒ~×&Ñ&¬/×*=Ñ*=Ó=Ü×&Ò& sÓ+ˆæÜœN°hÀÐ5EÑFˆ	Ü�cœ;×'Ñ'Ü2°3Ó7ˆCøä—J‘Jˆ	äƒ~×%×%Ö.?Ù�#ÕÜ	‹×	-×	-Ö2CÙ�#Õð 3DÐ	-r&   z2.0.0z1.25.0c                 óp  •  [        5       (       aM  [        R                  R                  5       nSU;  a  SUS'   [        R                  R	                  [
        5        OUR                  SS5        [        R                  " U 4SU0UD6n[        5       (       aD  [        R                  R                  5         W(       a  [        R                  R	                  U5        U$ ! [        5       (       aF  [        R                  R                  5         W(       a   [        R                  R	                  U5        f f f = f)að  
Compatible drop-in replacement of `torch.load()` which allows for `weights_only` to be used if `torch` version is
2.4.0 or higher. Otherwise will ignore the kwarg.

Will also add (and then remove) an exception for numpy arrays

Args:
    f:
        The file (or file-like object) to use to load the data
    map_location:
        a function, `torch.device`, string or a dict specifying how to remap storage locations
    **kwargs:
        Additional keyword arguments to pass to `torch.load()`.
Úweights_onlyTNÚmap_location)	r   r   ÚserializationÚget_safe_globalsÚadd_safe_globalsÚTORCH_SAFE_GLOBALSrs   ÚloadÚclear_safe_globals)r¤   r¨   ÚkwargsÚold_safe_globalsÚ
loaded_objs        r$   r­   r­   ˜  sí   € ðGÜ$×&Ñ&Ü$×2Ñ2×CÑCÓEÐØ VÓ+Ø)-��~Ñ&Ü×Ñ×0Ñ0Ô1CÕDà�J‰J�~ tÔ,Ü—Z’Z ÑG°ÐGÀÑGˆ
ä$×&Ñ&Ü×Ñ×2Ñ2Ô4ÞÜ×#Ñ#×4Ñ4Ð5EÔFØÐøô	 %×&Ñ&Ü×Ñ×2Ñ2Ô4ÞÜ×#Ñ#×4Ñ4Ð5EÕFð  ð 'ús   ‚BC ÃAD5c                 óê   • [        U S5      (       d  [        U S5      (       d  [        U SU 5      n [        U S5      (       a  U R                  $ [        U S5      (       a  U R                  $ [	        U 5      $ )z 
Gets a pretty name from `obj`.
Ú__qualname__Ú__name__r/   )r   rt   r³   r´   r„   )r£   s    r$   Úget_pretty_namerµ   ¸  sd   € ô �3˜×'Ñ'´¸¸Z×0HÑ0HÜ�c˜;¨Ó,ˆÜˆs�N×#Ñ#Ø×ÑÐÜˆs�J×ÑØ�|‰|ÐÜˆs‹8€Or&   c                 ó¨   • U R                  5        H=  u  p#[        U[        5      (       a  UR                  U0 5      n[	        X45        M9  X1U'   M?     U$ )z¯
Recursively merges two dictionaries.

Args:
    source (`dict`): The dictionary to merge into `destination`.
    destination (`dict`): The dictionary to merge `source` into.
)rƒ   r    ÚdictÚ
setdefaultÚmerge_dicts)ÚsourceÚdestinationÚkeyÚvalueÚnodes        r$   r¹   r¹   Å  sM   € ð —l‘l–n‰
ˆÜ�eœT×"Ñ"Ø×)Ñ)¨#¨rÓ2ˆDÜ˜Ö$à$˜Óñ %ð Ðr&   Úportc                 óÔ   • U c  Sn [         R                   " [         R                  [         R                  5       nUR                  SU 45      S:H  sSSS5        $ ! , (       d  f       g= f)z¦
Checks if a port is in use on `localhost`. Useful for checking if multiple `accelerate launch` commands have been
run and need to see if the port is already in use.
Ni<s  Ú	localhostr   )ÚsocketÚAF_INETÚSOCK_STREAMÚ
connect_ex)r¿   Úss     r$   Úis_port_in_userÇ   ×  sJ   € ð
 �|ØˆÜ	�Š”v—~‘~¤v×'9Ñ'9Ô	:¸aØ�|‰|˜[¨$Ð/Ó0°AÑ5÷ 
;×	:×	:ús   ¹AÁ
A'c                  óæ   • [         R                   " [         R                  [         R                  5       n U R                  S5        U R	                  5       S   sSSS5        $ ! , (       d  f       g= f)z®
Gets a free port on `localhost`. Useful for automatic port selection when port 0 is specified in distributed
training scenarios.

Returns:
    int: An available port number
)Ú r   r   N)rÂ   rÃ   rÄ   ÚbindÚgetsockname)rÆ   s    r$   Úget_free_portrÌ   â  sC   € ô 
�Š”v—~‘~¤v×'9Ñ'9Ô	:¸aØ	�‰ˆwŒØ�}‰}‹˜qÑ!÷ 
;×	:×	:ús   ´$A"Á"
A0c                 ón   • S H!  nU S:  a  [        U S5       SU 3s  $ U S-  n M#     [        U S5       S3$ )z7Converts `size` from bytes to the largest possible unit)ÚbytesÚKBÚMBÚGBÚTBg      �@r   Ú z PB)Úround)ÚsizeÚxs     r$   Úconvert_bytesr×   ï  sJ   € ã.ˆØ�&‹=Ü˜D !“nÐ% Q q cÐ*Ò*Ø�‰Šñ /ô
 �D˜!‹nÐ˜SÐ!Ð!r&   c                  ó
  • [         R                  " 5       n U R                  nUS:w  a  g[        R                  " SU R
                  5      tp#nSn[        U5      [        U5      :  a  SU SU S3n[        R                  USS	9  gg)
zFWarns if the kernel version is below the recommended minimum on Linux.ÚLinuxNz(\d+\.\d+\.\d+)z5.5.0zDetected kernel version z,, which is below the recommended minimum of zo; this can cause the process to hang. It is recommended to upgrade the kernel to the minimum version or higher.T)Úmain_process_only)	ÚplatformÚunameÚsystemÚreÚsplitÚreleaser	   r‡   rˆ   )ÚinforÝ   Ú_ÚversionÚmin_versionÚmsgs         r$   Úcheck_os_kernelræ   ù  s�   € ô �>Š>Ó€DØ�[‰[€FØ�ÓØä—X’XÐ0°$·,±,Ó?€N€A�Ø€KÜˆwÓœ' +Ó.Ó.à& w iÐ/[Ð\gÐ[hð isð sð 	ô 	�‰�s¨dˆÒ3ð /r&   Úattrc                 óD   • S n[        X /UR                  S5      -   5      $ )zµ
Recursive `getattr`.

Args:
    obj:
        A class instance holding the attribute.
    attr (`str`):
        The attribute that is to be retrieved, e.g. 'attribute1.attribute2'.
c                 ó   • [        X5      $ r=   )rt   )r£   rç   s     r$   Ú_getattrÚ#recursive_getattr.<locals>._getattr  s   € Ü�sÓ!Ð!r&   Ú.)r   rß   )r£   rç   rê   s      r$   Úrecursive_getattrrí     s#   € ò"ô �(˜E D§J¡J¨s£OÑ3Ó4Ð4r&   Úreturn_fqnsc                 óæ  • U(       d  U OSU 4nU/n/ nU(       aÑ  UR                  5       nU(       a  Uu  peUR                  5        Hm  u  px[        U[        R                  R
                  5      (       d  M0  U(       a%  W(       a  US-   U-   OUn	UR                  X˜45        M\  UR                  U5        Mo     U(       a  UR                  WU45        OUR                  U5        U(       a  MÑ  USSS2   $ )a)  Traverse the model in bottom-up order and return the children modules in that order.

Args:
    model (`torch.nn.Module`): the model to get the children of

Returns:
    `list[torch.nn.Module]`: a list of children modules of `model` in bottom-up order. The last element is the
    `model` itself.
rÉ   rì   Néÿÿÿÿ)rs   rC   r    r   r4   rK   r>   )
rR   rî   ÚtopÚstackÚordered_modulesÚcurrent_moduleÚcurrent_module_namerG   rç   Ú
child_names
             r$   Úget_module_children_bottom_upr÷     sÓ   € ö #‰%¨¨U¨€CØˆE€EØ€OÞ
ØŸ™›ˆÞØ2@Ñ/ÐØ(×7Ñ7Ö9‰JˆDÜ˜$¤§¡§¡×0Ó0ÞÞEXÐ!4°sÑ!:¸TÒ!AÐ^b�JØ—L‘L *Ð!3Ö4à—L‘L Ö&ñ :ö Ø×"Ñ"Ð$7¸Ð#HÕIà×"Ñ" >Ô2÷ ˆ%ð ™4˜R˜4Ñ Ð r&   )TTF)FFr=   )F)Wr€   rÛ   rÞ   rÂ   Úcodecsr   r   Ú	functoolsr   r   Útypesr   Útypingr   ÚnumpyÚnpr   Úpackaging.versionr	   Úsafetensors.torchr
   rŸ   Úcommands.config.defaultr   Úloggingr   Ústater   Ú	constantsr   Údataclassesr   Úimportsr   r   r   r   r   Úmodelingr   Útransformer_enginer   Úversionsr   r´   r‡   Útorch_xla.core.xla_modelÚcoreÚ	xla_modelr�   r4   rK   Úboolr%   r,   r8   r:   rL   rP   r]   r{   r}   r·   r”   r    Ú_coreÚnp_coreÚ
multiarrayÚ_reconstructÚndarrayÚdtyper¬   r>   ÚdtypesÚUInt32DTyper­   rµ   r¹   ÚintrÇ   rÌ   r×   ræ   r„   rí   r‚   r÷   rN   r&   r$   Ú<module>r     sn  ðó Û Û 	Û Ý Ý #ß %Ý Ý ã Û Ý %Ý 9å 8Ý  Ý  Ý +Ý (÷õ õ (Ý -Ý &ñ 
�HÓ	€ñ ×Ñß)Ð)ðH˜uŸx™xŸ™ð H°4ô Hð §¡§¡ð °Tô ð
˜uŸx™xŸ™ð 
°4ô 
ð §¡§¡ð °Dô ðE˜EŸH™HŸO™Oð EÀ%Ç(Á(Ç/Á/ô EðP) e§h¡h§o¡oô )ð0C˜UŸX™XŸ_™_ð C°ô Cð* _dñUØ"ðUØ?CðUØW[õUòp
'ð °ô  ñF Dð Àdõ ñH )¨×1Ñ1ˆ"�(Š(°r·w±w€ð ×Ñ×#Ñ#Ø‡J�Jà
Ø‡H�HðÐ ñ �h×ÑØ×Ñ˜bŸi™i×3Ñ3Ô4ôò@
òñ$6˜ #™ð 6°$õ 6ð
"�sô 
"ò"ò4ð$5 ô 5ñ"!¨¯©¯©ð !Àtð !ÐX\Ð]b×]eÑ]e×]lÑ]lÑXmö !r&   