+
    &j                     "    ^ RI t  ! R R4      tR# )    Nc                      a  ] tR t^t o RtV 3R lR lt]R 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R tR tRtV tR# )_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.
c                D   < V ^8  d   QhRS[ S[P                  ,          /# )   remote_device)strtorchdevice)format__classdict__s   "w/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributed/remote_device.py__annotate___remote_device.__annotate__   s     -. -.cELL&8 -.    c                   R V R2pRV n         RV n        RV n        \        V\        P
                  4      '       d   Wn        M\        V\        4      '       d   VP                  R4      p\        V4      ^8X  d   Vw  V n         V n        My\        V4      ^8X  dH   \        P                  V^ ,          4      '       d   V^ ,          V n        M8V^ ,          V n         RV n        M"\        V4      h\        R\        V4       24      hV P                   e   V P                   '       g   \        V4      h\        P
                  ! V P                  4      V n        V P                   e   V P                   P                  R4      p\        V4      ^8X  dW   V^ ,          R8X  d>   V^,          P                  4       '       d!   \        V^,          4      V n        RV n         R# \        V4      h\        V4      ^8  d   \        V4      hR# R# )zCould not parse remote_device: zU. The valid format is '<workername>/<device>' or 'rank:<rank>/<device>' or '<device>'N/cpuz Invalid type for remote_device: :rank)_worker_name_rank_device
isinstancer	   r
   r   splitlenr   _is_valid_local_device
ValueError	TypeErrortypeisdigitint)selfr   PARSE_ERRORfieldss   &&  r   __init___remote_device.__init__   s   -m_ =N N 	 !
8<mU\\22(Ls++"((-F6{a28/!4<V!!88CC#)!9DL(.q	D%#(DL -->tM?R>STUU (1B1B1B[)) ||DLL1 (&&,,S1F6{a!9&6!9+<+<+>+>!$VAYDJ(,D%$[11Vq -- ! )r   c                X     \         P                  ! V 4       R #   \         d     R# i ; i)TF)r	   r
   	Exception)r
   s   &r   r   %_remote_device._is_valid_local_deviceG   s(    	LL  		s    ))c                .   < V ^8  d   QhRS[ R,          /# r   returnN)r   )r   r   s   "r   r   r   P   s     ! !S4Z !r   c                    V P                   # )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_nameP   s       r   c                .   < V ^8  d   QhRS[ R,          /# r+   )r!   )r   r   s   "r   r   r   T   s      cDj r   c                    V P                   # )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.rankT   s    
 zzr   c                4   < V ^8  d   QhRS[ P                  /# )r   r,   )r	   r
   )r   r   s   "r   r   r   [   s       r   c                    V P                   # )z-Return the local device on the remote worker.)r   r.   s   &r   r
   _remote_device.device[   s    ||r   c                p   V P                   ei   V P                  e   V P                   RV P                    2# V P                  e   RV P                   RV P                    2# \        V P                   4      # V P                  e   V P                   # V P                  e   V P                   # \	        R4      h)Nr   zrank:zInvalid state!)r   r   r   r   RuntimeErrorr.   s   &r   __repr___remote_device.__repr___   s    <<#  ,++,Adll^<<'tzzl!DLL>::4<<((  ,++,-'**&"#344r   c                    \        V\        4      ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # N)r   r   r   r   r   )r"   others   &&r   __eq___remote_device.__eq__o   sc    %0 
 
!3!33 * *-* *

ekk)	
r   c                    \        V P                  4      \        V P                  4      ,          \        V P                  4      ,          # r<   )hashr   r   r   r.   s   &r   __hash___remote_device.__hash__v   s/    D%%&dll);;d4::>NNNr   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__r%   staticmethodr   r/   r   r
   r9   r>   rB   __static_attributes____classdictcell__)r   s   @r   r   r      s]     "-. -.^  ! !  5 
O Or   r   )r	   r    r   r   <module>rM      s    qO qOr   