
    &Vjir                         U d dl Z d dlmZmZ d dlmZ  G d d          Z e j                    ae j        ej	        e j
        e         f         ed<   dej	        deddfd	Zdej	        dee         fd
ZdS )    N)castOptionalc                       e Zd ZdS )_StateN)__name__
__module____qualname__     ]/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/distributed/_composable_state.pyr   r      s        Dr   r   _module_state_mappingmodulestatereturnc                 l    | t           vsJ d|  d            t          j        |          t           | <   d S )Nz
Inserting z more than once.)r   weakrefref)r   r   s     r   _insert_module_stater      sC    ....0UV0U0U0U...$+K$6$6&!!!r   c                     t          | t                    rt          t          |           S | t          v r*t          |          } |            }|t	          d          |S dS )at  
    Return the ``_State`` in ``model``.

    Given a ``module``, this API finds out if the module is also a ``_State``
    instance or if the module is managed by a composable API. If the module
    is also a ``_State``, ``module`` will be casted to ``_State` and returned.
    If it is managed by a composable API, the corresponding ``_State`` will
    be returned.
    Nz(State has already been garbage collected)
isinstancer   r   r   AssertionError)r   	state_refr   s      r   _get_module_stater      sg     &&!! FF### ***-f5IIKKE}$%OPPPL4r   )r   typingr   r   torch.nnnnr   WeakKeyDictionaryr   ModuleReferenceType__annotations__r   r   r
   r   r   <module>r!      s     ! ! ! ! ! ! ! !      	 	 	 	 	 	 	 	 G w0Iw$V,,      
7 76 7d 7 7 7 7bi HV,<      r   