+
    œ°³j  ã                   óP   € ^ RI t ^ RIt^ RIHtHt ^ RIHt ] ! R R4      4       tR# )é    N)ÚasdictÚ	dataclass)ÚLiteralc                   ó®   a € ] tR t^t o RtRtRtRtRtRt	Rt
RtRtR t]V 3R lR l4       tV 3R lR ltV 3R	 lR
 ltV 3R lR ltR tV 3R ltRtV tR# )ÚDistributedConfiga}  
Configuration for native distributed inference and training with tensor, pipeline, or FSDP2 parallelism.

Args:
    tp_size (`int`, *optional*):
        Number of devices for tensor parallelism. If `None` and `tp_plan` is set, defaults to
        `WORLD_SIZE // (other_parallel_size)`. If `None` and no `tp_plan` is set, defaults to 1.
    tp_plan (`dict[str, str]` or `"auto"`, *optional*):
        Tensor parallel sharding plan. Pass `"auto"`, or leave as `None` when `tp_size` is set, to use the
        model's predefined `base_model_tp_plan`. Pass a dictionary to override the predefined plan.
    enable_sequence_parallel (`bool`, *optional*, defaults to `False`):
        Reserved for sequence parallelism. Not wired up yet.
    enable_expert_parallel (`bool`, *optional*, defaults to `False`):
        Route MoE models through the expert-parallel path (``base_model_ep_plan``).
    fsdp_size (`int`, *optional*):
        Number of devices for FSDP (data parallelism). If `None` and `tp_size` is set, defaults to 1.
    fsdp_cpu_offload (`bool`, *optional*, defaults to `False`):
        Whether to enable CPU offloading for FSDP2.
    fsdp_mixed_precision (`bool`, *optional*, defaults to `False`):
        Whether to enable mixed precision for FSDP2.
    pp_size (`int`, *optional*):
        Number of devices for pipeline parallelism. If `None` and another parallel mode is set, defaults to 1.
NFc                óš  € V P                   f-   V P                  f   V P                  f   V P                  f   R # V P                  f   ^V n        V P                  f   ^V n        V P                  f‚   V P                   et   \	        \
        P                  P                  R^4      4      pV P                  V P                  ,          pW,          ^ 8w  d   \        RV RV R24      hW,          V n        MV P                  f   ^V n        V P                  ^8”  d2   V P                  ^8”  d   V P                  ^8”  d   \        R4      hR # R # R # )NÚ
WORLD_SIZEzWORLD_SIZE (z,) must be divisible by fsdp_size * pp_size (z) to derive tp_size.z¹FSDP+TP+PP is not supported yet. Use DistributedConfig(fsdp_size=N) or DistributedConfig(tp_size=N) or DistributedConfig(pp_size=N), not all three. Only 1D support is available for now.)	Útp_planÚtp_sizeÚ	fsdp_sizeÚpp_sizeÚintÚosÚenvironÚgetÚ
ValueError)ÚselfÚ
world_sizeÚother_parallel_sizes   &  Úm/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/distributed/configuration_utils.pyÚ__post_init__ÚDistributedConfig.__post_init__8   s  € Ø�<‰<Ò D§L¡LÒ$8¸T¿^¹^Ò=SÐX\×XdÑXdÒXlÙà�>‰>Ò!ØˆDŒNØ�<‰<ÒØˆDŒLØ�<‰<Ò D§L¡LÒ$<ÜœRŸZ™ZŸ^™^¨L¸!Ó<Ó=ˆJØ"&§.¡.°4·<±<Õ"?ÐØÕ/°1Ô4Ü Ø" : ,ð /Ø+Ð,Ð,@ðBóð ð &Õ<ˆD�LØ�\‰\Ò!ØˆDŒLà�<‰<˜!Ô §¡°Ô 2°t·|±|ÀaÔ7GÜð8óð ñ 8HÑ 2Ñó    c                ó$   <€ V ^8„  d   QhRS[ RR/# )é   Úconfig_dictÚreturnr   ©Údict)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚDistributedConfig.__annotate__T   s    ø€ ÷ Kñ K¡Dð KÐ7Jñ Kr   c           
     óì   € / VCVCpV P                   P                  4        Uu0 uF  qDP                  kK  	  ppT ! R/ VP                  4        UUu/ uF  w  rgWe9   g   K  WgbK  	  uppB # u upi u uppi )N© )Ú__dataclass_fields__ÚvaluesÚnameÚitems)Úclsr   ÚkwargsÚmergedÚfÚ
valid_keysÚkÚvs   &&,     r   Ú	from_dictÚDistributedConfig.from_dictS   sn   € à*�KÐ* 6Ð*ˆØ&)×&>Ñ&>×&EÑ&EÔ&GÓHÑ&G —f”fÑ&Gˆ
ÐHÙÑJ v§|¡|¤~ÔI¡~™t˜q¸¹”d�a’d¡~ÒIÑJÐJùò IùÛIs   £A+Á
A0ÁA0c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   r   )r    r!   s   "€r   r"   r#   Y   s   ø€ ÷ ñ ™ñ r   c                ó   € \        V 4      # )N)r   ©r   s   &r   Úto_dictÚDistributedConfig.to_dictY   s   € Ü�d‹|Ðr   c                ó    <€ V ^8„  d   QhRS[ /# r4   )Ústr)r    r!   s   "€r   r"   r#   \   s   ø€ ÷ ;ñ ;¡ñ ;r   c                ó\   € \         P                  ! V P                  4       ^R7      R,           # )r   )ÚindentÚ
)ÚjsonÚdumpsr7   r6   s   &r   Úto_json_stringÚ DistributedConfig.to_json_string\   s   € Ü�zŠz˜$Ÿ,™,›.°Ô3°dÕ:Ð:r   c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# )r   Újson_file_path)r:   r   ÚPathLike)r    r!   s   "€r   r"   r#   _   s   ø€ ÷ +ñ +©3±·±Õ+<ñ +r   c                óª   € \        VR RR7      ;_uu_ 4       pVP                  V P                  4       4       RRR4       R#   + '       g   i     R# ; i)Úwzutf-8)ÚencodingN)ÚopenÚwriter@   )r   rC   r-   s   && r   Úto_json_fileÚDistributedConfig.to_json_file_   s7   € Ü�. #°×8Õ8¸AØ�G‰G�D×'Ñ'Ó)Ô*÷ 9×8×8Ò8ús   — AÁA	c                óT   € V P                   P                   R V P                  4        2# )Ú )Ú	__class__Ú__name__r@   r6   s   &r   Ú__repr__ÚDistributedConfig.__repr__c   s(   € Ø—.‘.×)Ñ)Ð*¨!¨D×,?Ñ,?Ó,AÐ+BÐCÐCr   c                óæ   <€ V ^8„  d   Qh/ S[ R,          ;R&   S[S[S[3,          S[R,          ,          R,          ;R&   S[;R&   S[;R&   S[ R,          ;R&   S[;R&   S[;R	&   S[ R,          ;R
&   # )r   Nr   Úautor
   Úenable_sequence_parallelÚenable_expert_parallelr   Úfsdp_cpu_offloadÚfsdp_mixed_precisionr   )r   r   r:   r   Úbool)r    r!   s   "€r   r"   r#      s“   ø‡ ‚ ñ4 �4�ZÑñ5 ñ6 ‘#‘s�(�^™g f�oÕ-°Õ4Ñ;ñ7 ñ8 #Ñ*ñ9 ñ: !Ñ(ñ; ñ< �T�zÑ ñ= ñ> Ñ"ñ? ñ@ Ñ&ñA ñB �4�ZÑòC r   )r   r   r   )rO   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r
   rT   rU   r   rV   rW   r   r   Úclassmethodr1   r7   r@   rJ   rP   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r!   s   @r   r   r      s   ø‡ € ñð0 €GØ7;€GØ%*ÐØ#(ÐØ €IØ"ÐØ!&ÐØ€Gòð6 ÷Kó ðK÷
ð ÷;ð ;÷+ð +òD÷] ƒ r   r   )r>   r   Údataclassesr   r   Útypingr   r   r%   r   r   Ú<module>rc      s2   ðó Û 	ß )Ý ð ÷NDð NDó òNDr   