Ë
    g^(hø  ã                   ó0   — d dl mZmZ d dlZ G d„ d«      Zy)é    )ÚOptionalÚUnionNc                   ó    — e Zd ZdZdeeej                  f   fd„Ze	d„ «       Z
dee   fd„Zdee   fd„Zdej                  fd„Zd	„ Zd
„ Zd„ Zy)Ú_remote_devicea@  
    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                 ót  — d|› d�}d | _         d | _        d | _        t        |t        j
                  «      r|| _        n¤t        |t        «      r}|j                  d«      }t        |«      dk(  r|\  | _         | _        net        |«      dk(  r5t        j                  |d   «      r|d   | _        n4|d   | _         d| _        n"t        |«      ‚t        dt        |«      › �«      ‚| j                   �| j                   st        |«      ‚t	        j
                  | j                  «      | _        | j                   �„| j                   j                  d	«      }t        |«      dk(  rA|d   d
k(  r.|d   j                  «       rt        |d   «      | _        d | _         y t        |«      ‚t        |«      dkD  rt        |«      ‚y y )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       ú]/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/distributed/remote_device.pyÚ__init__z_remote_device.__init__   s   € à-¨m¨_ð =Nð Nð 	ð !ˆÔØˆŒ
Ø@DˆŒä�m¤U§\¡\Ô2Ø(ˆD�LÜ˜¤sÔ+Ø"×(Ñ(¨Ó-ˆFÜ�6‹{˜aÒØ28Ñ/�Ô! 4¥<Ü�V“ Ò!ä!×8Ñ8¸À¹Ô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                 óN   — 	 t        j                  | «       y# t        $ r Y yw xY w)NTF)r   r   Ú	Exception)r   s    r!   r   z%_remote_device._is_valid_local_deviceH   s(   € ð	Ü�L‰L˜Ô ØøÜò 	Ùð	ús   ‚ ˜	$£$Úreturnc                 ó   — | j                   S )zlReturn the name of remote worker representing the remote device and ``None`` if no worker name is available.)r   ©r   s    r!   Úworker_namez_remote_device.worker_nameQ   s   € à× Ñ Ð r#   c                 ó   — | j                   S )z…
        Returns the rank of remote worker representing the remote device.
        Returns ``None`` if no rank is available.
        )r   r(   s    r!   r   z_remote_device.rankU   s   € ð
 �z‰zÐr#   c                 ó   — | j                   S )z-Return the local device on the remote worker.)r   r(   s    r!   r   z_remote_device.device\   s   € à�|‰|Ðr#   c                 ó\  — | j                   �d| j                  �| j                  › d| j                   › �S | j                  �d| j                  › d| j                   › �S t        | j                   «      S | j                  �| j                  › S | j                  �| j                  › S t	        d«      ‚)Nr	   zrank:zInvalid state!)r   r   r   r   ÚRuntimeErrorr(   s    r!   Ú__repr__z_remote_device.__repr__`   s¥   € Ø�<‰<Ð#Ø× Ñ Ð,Ø×+Ñ+Ð,¨A¨d¯l©l¨^Ð<Ð<Ø—‘Ð'Ø˜tŸz™z˜l¨!¨D¯L©L¨>Ð:Ð:ä˜4Ÿ<™<Ó(Ð(à× Ñ Ð,Ø×+Ñ+Ð,Ð-Ø—‘Ð'ØŸ*™*˜Ð&ä"Ð#3Ó4Ð4r#   c                 óÄ   — t        |t        «      xrO | j                  |j                  k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S ©N)r   r   r   r   r   )r   Úothers     r!   Ú__eq__z_remote_device.__eq__p   sT   € Ü˜%¤Ó0ò 
Ø×Ñ ×!3Ñ!3Ñ3ò *Ø—‘ §¡Ñ-ò*à—
‘
˜eŸk™kÑ)ð	
r#   c                 ó„   — t        | j                  «      t        | j                  «      z  t        | j                  «      z  S r0   )Úhashr   r   r   r(   s    r!   Ú__hash__z_remote_device.__hash__w   s/   € Ü�D×%Ñ%Ó&¬¨d¯l©lÓ);Ñ;¼dÀ4Ç:Á:Ó>NÑNÐNr#   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r"   Ústaticmethodr   r   r)   r   r   r.   r2   r5   © r#   r!   r   r      sv   „ ñð"-. e¨C°·±Ð,=Ñ&>ó -.ð^ ñó ðð!˜X c™]ó !ð�h˜s‘mó ð˜Ÿ™ó ò5ò 
óOr#   r   )Útypingr   r   r   r   r;   r#   r!   ú<module>r=      s   ðç "ã ÷qOò qOr#   