ó
    Eñib  ã                   ó    • S SK r  " S S5      rg)é    Nc                   ó¬   • \ rS rSrSrS\\R                  -  4S jr\	S 5       r
S\S-  4S jrS\S-  4S	 jrS\R                  4S
 jrS rS rS rSrg)Ú_remote_deviceé   a  
Represents a device on a remote worker.

Args:
    remote_device (str or torch.device): Represents a device on a remote worker.
        The string format should be one of the following:

            1. "<workername>/<device>", where the device field can be parsed as torch.device type.
               E.g., "trainer0/cpu", "trainer0", "ps0/cuda:0".
               In addition, the device field can be optional and the default value is "cpu".
            2. "rank:<rank>/<device>", where <rank> is the rank of the
               process and device can be parsed as torch.device type.
               E.g., "rank:0/cpu", "rank:0", "rank:0/cuda:0"
            3. <workername> and <rank> are optional and formats like "cpu"
                and "cuda:1", just represent local devices.
Úremote_devicec                 ó´  • SU S3nS U l         S U l        S U l        [        U[        R
                  5      (       a  Xl        O°[        U[        5      (       a„  UR                  S5      n[        U5      S:X  a  Uu  U l         U l        Ok[        U5      S:X  a:  [        R                  US   5      (       a  US   U l        O4US   U l         SU l        O"[        U5      e[        S[        U5       35      eU R                   b  U R                   (       d  [        U5      e[        R
                  " U R                  5      U l        U R                   bŒ  U R                   R                  S	5      n[        U5      S:X  aG  US   S
:X  a3  US   R                  5       (       a  [        US   5      U l        S U l         g [        U5      e[        U5      S:”  a  [        U5      eg g )NzCould not parse remote_device: zU. The valid format is '<workername>/<device>' or 'rank:<rank>/<device>' or '<device>'Ú/é   é   r   Úcpuz Invalid type for remote_device: Ú:Úrank)Ú_worker_nameÚ_rankÚ_deviceÚ
isinstanceÚtorchÚdeviceÚstrÚsplitÚlenr   Ú_is_valid_local_deviceÚ
ValueErrorÚ	TypeErrorÚtypeÚisdigitÚint)Úselfr   ÚPARSE_ERRORÚfieldss       Ú\/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/distributed/remote_device.pyÚ__init__Ú_remote_device.__init__   s¬  € à-¨m¨_ð =Nð Nð 	ð !ˆÔØˆŒ
Ø8<ˆŒä�m¤U§\¡\×2Ñ2Ø(�LÜ˜¤s×+Ñ+Ø"×(Ñ(¨Ó-ˆFÜ�6‹{˜aÓà28Ñ/�Ô! 4¥<Ü�V“ Ó!ä!×8Ñ8¸À¹×CÑCØ#)¨!¡9�D•Lð )/¨q©	�DÔ%Ø#(�D•Lä  Ó-Ð-äÐ>¼tÀMÓ?RÐ>SÐTÓUÐUð ×ÑÑ(°×1B×1BÜ˜[Ó)Ð)ô —|’| D§L¡LÓ1ˆŒð ×ÑÑ(Ø×&Ñ&×,Ñ,¨SÓ1ˆFÜ�6‹{˜aÓà˜!‘9 Ó&¨6°!©9×+<Ñ+<×+>Ñ+>Ü!$ V¨A¡Y£�D”Jà(,�DÕ%ä$ [Ó1Ð1Ü�V“˜q“Ü  Ó-Ð-ð !ð )ó    c                 óR   •  [         R                  " U 5        g! [         a     gf = f)NTF)r   r   Ú	Exception)r   s    r    r   Ú%_remote_device._is_valid_local_deviceJ   s(   € ð	Ü�LŠL˜Ô ØøÜó 	Ùð	ús   ‚ ™
&¥&ÚreturnNc                 ó   • U R                   $ )zlReturn the name of remote worker representing the remote device and ``None`` if no worker name is available.)r   ©r   s    r    Úworker_nameÚ_remote_device.worker_nameS   s   € à× Ñ Ð r#   c                 ó   • U R                   $ )zm
Returns the rank of remote worker representing the remote device.
Returns ``None`` if no rank is available.
)r   r)   s    r    r   Ú_remote_device.rankW   s   € ð
 �z‰zÐr#   c                 ó   • U R                   $ )z-Return the local device on the remote worker.)r   r)   s    r    r   Ú_remote_device.device^   s   € à�|‰|Ðr#   c                 óf  • U R                   bf  U R                  b  U R                   SU R                    3$ U R                  b  SU R                   SU R                    3$ [        U R                   5      $ U R                  b  U R                   $ U R                  b  U R                   $ [	        S5      e)Nr   zrank:zInvalid state!)r   r   r   r   ÚRuntimeErrorr)   s    r    Ú__repr__Ú_remote_device.__repr__b   s¥   € Ø�<‰<Ñ#Ø× Ñ Ñ,Ø×+Ñ+Ð,¨A¨d¯l©l¨^Ð<Ð<Ø—‘Ñ'Ø˜tŸz™z˜l¨!¨D¯L©L¨>Ð:Ð:ä˜4Ÿ<™<Ó(Ð(à× Ñ Ñ,Ø×+Ñ+Ð,Ð-Ø—‘Ñ'ØŸ*™*˜Ð&ä"Ð#3Ó4Ð4r#   c                 óâ   • [        U[        5      =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ ©N)r   r   r   r   r   )r   Úothers     r    Ú__eq__Ú_remote_device.__eq__r   sT   € Ü˜%¤Ó0÷ 
Ø×Ñ ×!3Ñ!3Ñ3÷ *Ø—‘ §¡Ñ-÷*à—
‘
˜eŸk™kÑ)ð	
r#   c                 ó„   • [        U R                  5      [        U R                  5      -  [        U R                  5      -  $ r5   )Úhashr   r   r   r)   s    r    Ú__hash__Ú_remote_device.__hash__y   s/   € Ü�D×%Ñ%Ó&¬¨d¯l©lÓ);Ñ;¼dÀ4Ç:Á:Ó>NÑNÐNr#   )r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r!   Ústaticmethodr   r*   r   r   r2   r7   r;   Ú__static_attributes__© r#   r    r   r      sq   † ñð"0. c¨E¯L©LÑ&8ô 0.ðd ñó ðð!˜S 4™Zô !ð�c˜D‘jô ð˜Ÿ™ô ò5ò 
õOr#   r   )r   r   rD   r#   r    Ú<module>rE      s   ðó ÷tOò tOr#   