§
    Pzni#  ã                   ó¤  — 	 d dl mZmZ n# e$ rZ ed¦  «        e‚dZ[ww xY wd dlZd dlZd dlZd dlm	Z	 d dl
mZmZ d dlmZmZmZmZ ddlmZ i ad	„ Zd
edeeef         fd„Zdededee         fd„Zddededefd„Zd„ Zd„ Zdefd„Zdefd„Zdefd„Z efdede	fd„Z!efdede	fd„Z" ede!¦  «          ede"¦  «          ede¦  «         dS ) é    )ÚurlparseÚ
urlunparsezEurllib cannot be found, urlparse from python2 is no longer supported.N)Ú	timedelta)ÚDictÚOptional)Ú	FileStoreÚPrefixStoreÚStoreÚTCPStoreé   )Údefault_pg_timeoutc                 óR   — | t           v rt          d| › d�¦  «        ‚|t           | <   dS )aÅ  Registers a new rendezvous handler.

    Before we can run collective algorithms, participating processes
    need to find each other and exchange information to be able to
    communicate. We call this process rendezvous.

    The outcome of the rendezvous process is a triplet containing a
    shared key/value store, the rank of the process, and the total
    number of participating processes.

    If none of the bundled rendezvous methods apply to your execution
    environment you can opt to register your own rendezvous handler.
    Pick a unique name and use the URL scheme to identify it when
    calling the `rendezvous()` function.

    Args:
        scheme (str): URL scheme to identify your rendezvous handler.
        handler (function): Handler that is invoked when the
            `rendezvous()` function is called with a URL that uses
            the corresponding scheme. It must be a generator function
            that yields the triplet.
    zRendezvous handler for z:// already registeredN)Ú_rendezvous_handlersÚRuntimeError)ÚschemeÚhandlers     ú|/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/distributed/rendezvous.pyÚregister_rendezvous_handlerr      sC   € ð0 Õ%Ð%Ð%ÝØD fÐDÐDÐDñ
ô 
ð 	
ð $+Õ˜Ñ Ð Ð ó    ÚqueryÚreturnc                 óp   — d„ d„ t          d |                      d¦  «        ¦  «        D ¦   «         D ¦   «         S )Nc                 ó,   — i | ]}|d          |d         “ŒS )r   r   © ©Ú.0Úpairs     r   ú
<dictcomp>z"_query_to_dict.<locals>.<dictcomp>8   s"   € ÐfÐfÐf ˆD�ŒG�T˜!”WÐfÐfÐfr   c              3   ó@   K  — | ]}|                      d ¦  «        V — ŒdS )ú=N)Úsplitr   s     r   ú	<genexpr>z!_query_to_dict.<locals>.<genexpr>8   s,   è è € Ð)eÐ)e¸d¨$¯*ª*°S©/¬/Ð)eÐ)eÐ)eÐ)eÐ)eÐ)er   ú&)Úfilterr!   ©r   s    r   Ú_query_to_dictr&   7   s?   € ØfÐfÐ)eÐ)eÅfÈTÐSX×S^ÒS^Ð_bÑScÔScÑFdÔFdÐ)eÑ)eÔ)eÐfÑfÔfÐfr   ÚurlÚrankÚworld_size_optc                 óò  — t          | ¦  «        }|€hd}|j        dk    rZt          t          j                             d|¦  «        ¦  «        }t          t          j                             d|¦  «        ¦  «        }n|}|dk    s|dk    s|€±t          |j        ¦  «        }d|vrd|vsJ d| › d�¦   «         ‚|dk    rt          |¦  «        |d<   |dk    s|€t          |¦  «        |d<   | 	                    d	 
                    d
„ |                     ¦   «         D ¦   «         ¦  «        › ¬¦  «        }t          |¦  «        } |j        t          vrt          d|j        › d�¦  «        ‚t          |j                 | fi |¤ŽS )NéÿÿÿÿÚenvÚRANKÚ
WORLD_SIZEr(   Ú
world_sizez	The url: z7 has node-specific arguments(rank, world_size) already.r#   c                 ó"   — g | ]\  }}|› d |› �‘ŒS )r    r   )r   ÚkÚvs      r   ú
<listcomp>z&_rendezvous_helper.<locals>.<listcomp>O   s&   € ÐIÐIÐI©d¨a° !˜z˜z a˜z˜zÐIÐIÐIr   r%   zNo rendezvous handler for z://)r   r   ÚintÚosÚenvironÚgetr&   r   ÚstrÚ_replaceÚjoinÚitemsr   r   r   )r'   r(   r)   ÚkwargsÚresultr/   Ú
query_dicts          r   Ú_rendezvous_helperr?   ;   s’  € Ý�c‰]Œ]€FØÐØˆ
ØŒ=˜EÒ!Ð!Ý•r”z—~’~ f¨dÑ3Ô3Ñ4Ô4ˆDå�RœZŸ^š^¨L¸*ÑEÔEÑFÔFˆJøà#ˆ
Øˆr‚z€z�Z 2Ò%Ð%¨Ð)?Ý# F¤LÑ1Ô1ˆ
à˜*Ð$Ð$¨¸ZÐ)GÐ)GÐ)GØS�sÐSÐSÐSñ *HÔ)GÐGà�2Š:ˆ:Ý!$ T¡¤ˆJ�vÑØ˜ÒÐ˜~Ð5Ý'*¨:¡¤ˆJ�|Ñ$Ø—’Ø—X’XÐIÐI°j×6FÒ6FÑ6HÔ6HÐIÑIÔIÑJÔJÐLð !ñ 
ô 
ˆõ ˜Ñ Ô ˆà„}Õ0Ð0Ð0ÝÐJ¸¼ÐJÐJÐJÑKÔKÐKÝ ¤Ô.¨sÐ=Ð=°fÐ=Ð=Ð=r   r+   r/   c                 óL  — t          | t          t          f¦  «        s"t          dt	          | ¦  «        › d| › �¦  «        ‚t          |t
          j        ¦  «        st          d|› �¦  «        ‚t          |t
          j        ¦  «        st          d|› �¦  «        ‚t          | ||fi |¤ŽS )Nz`url` must be a string. z: z`rank` must be an integer. z!`world_size` must be an integer. )Ú
isinstancer8   Úbytesr   ÚtypeÚnumbersÚIntegralr?   )r'   r(   r/   r<   s       r   Ú
rendezvousrF   X   s²   € Ý�c�C¥˜<Ñ(Ô(ð JÝÐHµd¸3±i´iÐHÐHÀ3ÐHÐHÑIÔIÐIå�d�GÔ,Ñ-Ô-ð AÝÐ?¸Ð?Ð?Ñ@Ô@Ð@å�j¥'Ô"2Ñ3Ô3ð MÝÐK¸zÐKÐKÑLÔLÐLå˜c 4¨Ð>Ð>°vÐ>Ð>Ð>r   c                 óT   — t          t          | j        |d ¦  «        ¦  «        \  }}}|S ©N)Únextr?   Úinit_method)Úbackend_optionsr(   ÚstoreÚ_s       r   Ú_create_store_from_optionsrN   e   s*   € ÝÕ)¨/Ô*EÀtÈTÑRÔRÑSÔS�K€Eˆ1ˆaØ€Lr   c                 ó&   — t          d| z   ¦  «        S )Nz+Error initializing torch.distributed using )Ú
ValueError©Úmsgs    r   Ú_rendezvous_errorrS   j   s   € ÝÐCÀcÑIÑJÔJÐJr   c              +   ó  K  — d„ }t          | ¦  «        }|j        }t          j        dk    rNdd l}|j        |j        z   }|j                             |¦  «        }|rt          j         	                    |¦  «        }|s |d¦  «        ‚t          |j        ¦  «        }d|vr |d¦  «        ‚d|vr |d¦  «        ‚t          |d         ¦  «        }t          |d         ¦  «        }	t          ||	¦  «        }
|
||	fV — t          d	¦  «        ‚)
Nc                 ó&   — t          d| z   ¦  «        S )Nzfile:// rendezvous: ©rS   rQ   s    r   Ú_errorz(_file_rendezvous_handler.<locals>._erroro   s   € Ý Ð!7¸#Ñ!=Ñ>Ô>Ð>r   Úwin32r   zpath missingr(   úrank parameter missingr/   úworld size parameter missingz3Unable to perform rerendezvous using file:// method)r   ÚpathÚsysÚplatformÚurllib.requestÚnetlocÚrequestÚurl2pathnamer5   Únormpathr&   r   r4   r   r   )r'   r<   rW   r=   r[   ÚurllibÚ	full_pathr>   r(   r/   rL   s              r   Ú_file_rendezvous_handlerre   n   s8  è è € ð?ð ?ð ?õ �c‰]Œ]€FØŒ;€DÝ
„|�wÒÐØÐÐÐà”M F¤KÑ/ˆ	ØŒ~×*Ò*¨9Ñ5Ô5ˆØð 	*å”7×#Ò# DÑ)Ô)ˆDàð %Øˆf�^Ñ$Ô$Ð$Ý ¤Ñ-Ô-€JØ�ZÐÐØˆfÐ-Ñ.Ô.Ð.Ø˜:Ð%Ð%ØˆfÐ3Ñ4Ô4Ð4åˆz˜&Ô!Ñ"Ô"€DÝ�Z Ô-Ñ.Ô.€JÝ�d˜JÑ'Ô'€EØ�$˜
Ð
#Ð#Ð#Ð#õ ÐLÑ
MÔ
MÐMr   c                  ód   — t           j                             dd ¦  «        t          d¦  «        k    S )NÚTORCHELASTIC_USE_AGENT_STORET)r5   r6   r7   r8   r   r   r   Ú_torchelastic_use_agent_storerh   Ž   s$   € ÝŒ:�>Š>Ð8¸$Ñ?Ô?Å3ÀtÁ9Ä9ÒLÐLr   c                 ó  — d|cxk    rdk     sn t          d|› d�¦  «        ‚t          ¦   «         r8t          j        d         }t	          | ||d|¦  «        }t          d|› �|¦  «        S |dk    }t	          | ||||d¬	¦  «        S )
a  
    Smartly creates a c10d Store object on ``rank`` based on whether
    we need to re-use agent store. The TCPStore server is assumed to be hosted
    on ``hostname:port``.

    If ``torchelastic_use_agent_store()`` is ``True``, then it is assumed that
    the agent leader (node rank 0) hosts the TCPStore server (for which the
    endpoint is specified by the given ``hostname:port``). Hence
    ALL ranks will create and return a TCPStore client (e.g. ``start_daemon=False``).

    If ``torchelastic_use_agent_store()`` is ``False``, then rank 0 will host
    the TCPStore (with multi-tenancy) and it is assumed that rank 0's hostname
    and port are correctly passed via ``hostname`` and ``port``. All
    non-zero ranks will create and return a TCPStore client.
    r   i   z-port must have value from 0 to 65535 but was ú.ÚTORCHELASTIC_RESTART_COUNTFz/worker/attempt_T)Úmulti_tenant)rP   rh   r5   r6   r   r	   )ÚhostnameÚportr(   r/   ÚtimeoutÚattemptÚ	tcp_storeÚstart_daemons           r   Ú_create_c10d_storers   ’   s³   € ð" �ÐÐÒÐ�uÒÐÐÐÝÐPÈÐPÐPÐPÑQÔQÐQå$Ñ&Ô&ð 
Ý”*Ð9Ô:ˆÝ˜X t¨Z¸ÀÑHÔHˆ	ÝÐ7¨gÐ7Ð7¸ÑCÔCÐCà˜q’yˆÝØ�d˜J¨°gÈDð
ñ 
ô 
ð 	
r   ro   c              +   ó~  K  — d„ }t          | ¦  «        }|j        s |d¦  «        ‚t          |j        ¦  «        }d|vr |d¦  «        ‚d|vr |d¦  «        ‚t	          |d         ¦  «        }t	          |d         ¦  «        }|j        €J ‚t          |j        |j        |||¦  «        }|||fV — t          d¦  «        ‚)Nc                 ó&   — t          d| z   ¦  «        S )Nztcp:// rendezvous: rV   rQ   s    r   rW   z'_tcp_rendezvous_handler.<locals>._error´   ó   € Ý Ð!6¸Ñ!<Ñ=Ô=Ð=r   zport number missingr(   rY   r/   rZ   z3Unable to perform re-rendezvous using tcp:// method)r   rn   r&   r   r4   rm   rs   r   )	r'   ro   r<   rW   r=   r>   r(   r/   rL   s	            r   Ú_tcp_rendezvous_handlerrw   ±   só   è è € ð>ð >ð >õ �c‰]Œ]€FØŒ;ð ,ØˆfÐ*Ñ+Ô+Ð+Ý ¤Ñ-Ô-€JØ�ZÐÐØˆfÐ-Ñ.Ô.Ð.Ø˜:Ð%Ð%ØˆfÐ3Ñ4Ô4Ð4åˆz˜&Ô!Ñ"Ô"€DÝ�Z Ô-Ñ.Ô.€JØŒ?Ð&Ð&Ð&å˜vœ°´¸TÀ:ÈwÑWÔW€Eà�$˜
Ð
#Ð#Ð#Ð#õ ÐLÑ
MÔ
MÐMr   c              +   óè  ‡‡K  — d„ Šˆfd„Šdt           dt           fˆfd„}t          | ¦  «        }t          |j        ¦  «        }d|v rt	          |d         ¦  «        }nt	           |d¦  «        ¦  «        }d|v rt	          |d         ¦  «        }nt	           |d	¦  «        ¦  «        } |d
¦  «        }t	           |d¦  «        ¦  «        }	t          ||	|||¦  «        }
|
||fV — t          d¦  «        ‚)Nc                 ó&   — t          d| z   ¦  «        S )Nzenv:// rendezvous: rV   rQ   s    r   rW   z'_env_rendezvous_handler.<locals>._errorÏ   rv   r   c                 ó"   •—  ‰d| › d�¦  «        S )Nzenvironment variable z expected, but not setr   )ÚvarrW   s    €r   Ú
_env_errorz+_env_rendezvous_handler.<locals>._env_errorÒ   s   ø€ ØˆvÐI¨cÐIÐIÐIÑJÔJÐJr   Úenv_varr   c                 ób   •— t           j                             | d ¦  «        }|s ‰| ¦  «        ‚|S rH   )r5   r6   r7   )r}   Úenv_valr|   s     €r   Ú_get_env_or_raisez2_env_rendezvous_handler.<locals>._get_env_or_raiseÕ   s5   ø€ Ý”*—.’. ¨$Ñ/Ô/ˆØð 	Ø�*˜WÑ%Ô%Ð%àˆNr   r(   r-   r/   r.   ÚMASTER_ADDRÚMASTER_PORTz3Unable to perform re-rendezvous using env:// method)r8   r   r&   r   r4   rs   r   )r'   ro   r<   r€   r=   r>   r(   r/   Úmaster_addrÚmaster_portrL   r|   rW   s              @@r   Ú_env_rendezvous_handlerr…   Ì   sQ  øøè è € ð>ð >ð >ðKð Kð Kð Kð Kð¥3ð ­3ð ð ð ð ð ð õ �c‰]Œ]€FÝ ¤Ñ-Ô-€Jð �ÐÐÝ�:˜fÔ%Ñ&Ô&ˆˆåÐ$Ð$ VÑ,Ô,Ñ-Ô-ˆà�zÐ!Ð!Ý˜ LÔ1Ñ2Ô2ˆ
ˆ
åÐ*Ð*¨<Ñ8Ô8Ñ9Ô9ˆ
à#Ð# MÑ2Ô2€KÝÐ'Ð'¨Ñ6Ô6Ñ7Ô7€Kå˜{¨K¸¸zÈ7ÑSÔS€Eà�$˜
Ð
#Ð#Ð#Ð#õ ÐLÑ
MÔ
MÐMr   Útcpr,   Úfile)r+   r+   )#Úurllib.parser   r   ÚImportErrorÚerD   r5   r\   Údatetimer   Útypingr   r   Útorch.distributedr   r	   r
   r   Ú	constantsr   r   r   r8   r&   r4   r?   rF   rN   rS   re   Úboolrh   rs   rw   r…   r   r   r   ú<module>r�      s«  ððØ1Ð1Ð1Ð1Ð1Ð1Ð1Ð1Ð1øØð ð ð Ø
ˆ+ØOñô àðøøøøðøøøð
 €€€Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ð !Ð !à EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ Eà )Ð )Ð )Ð )Ð )Ð )ð Ð ð+ð +ð +ðBg˜#ð g $ s¨C x¤.ð gð gð gð gð>˜Cð > sð >¸HÀS¼Mð >ð >ð >ð >ð:
?ð 
?�Cð 
?˜sð 
?°Sð 
?ð 
?ð 
?ð 
?ðð ð ð
Kð Kð KðN #ð Nð Nð Nð Nð@M tð Mð Mð Mð Mð
ÀUð 
ð 
ð 
ð 
ð@ $6ðNð NØ	ðNØ ðNð Nð Nð Nð8 $6ð*Nð *NØ	ð*NØ ð*Nð *Nð *Nð *NðZ Ð ˜EÐ#:Ñ ;Ô ;Ð ;Ø Ð ˜EÐ#:Ñ ;Ô ;Ð ;Ø Ð ˜FÐ$<Ñ =Ô =Ð =Ð =Ð =s   ‚ ‹!�œ!