
    -`i                         d dl Z d dlZd dlmZ d dlmZmZmZ d dlm	Z	 d dl
mZ ed         Zed         Zeeef         Zee	 G d d	                                  ZdS )
    N)field)AnyLiteralget_args)	dataclass)configec_producerec_consumerc                      e Zd ZU dZdZedz  ed<   	 dZedz  ed<   	 dZedz  ed<   	 dZ	e
ed<   	 dZedz  ed	<   	 dZedz  ed
<   	 dZeed<   	 dZeed<   	 dZeed<   	  ee          Zeeef         ed<   	 dZedz  ed<   	 defdZddZedefd            Zedefd            Zedefd            ZdefdZdS )ECTransferConfigz0Configuration for distributed EC cache transfer.Nec_connector	engine_idcudaec_buffer_deviceg    eAec_buffer_sizeec_roleec_rank   ec_parallel_sizez	127.0.0.1ec_ipi8  ec_port)default_factoryec_connector_extra_configec_connector_module_pathreturnc                     g }t          j        t          |                                          d                                          }|S )a  
        WARNING: Whenever a new field is added to this config,
        ensure that it is included in the factors list if
        it affects the computation graph.

        Provide a hash that uniquely identifies all the configs
        that affect the structure of the computation
        graph from input ids/embeddings to the final hidden states,
        excluding anything before input ids/embeddings and after
        the final hidden states.
        F)usedforsecurity)hashlibmd5strencode	hexdigest)selffactorshash_strs      k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/config/ec_transfer.pycompute_hashzECTransferConfig.compute_hash?   s@      ;s7||2244eLLLVVXX    c                 b   | j         %t          t          j                              | _         | j        G| j        t          t                    vr,t          d| j         dt          t                               | j        +| j        &t          dt          t                               d S d S )NzUnsupported ec_role: z. Supported roles are zEPlease specify ec_role when ec_connector is set, supported roles are )	r   r    uuiduuid4r   r   ECRole
ValueErrorr   r#   s    r&   __post_init__zECTransferConfig.__post_init__Q   s    >! ..DN<#HV<L<L(L(L: : :'/'7'7: :  
 (T\-AB/7/?/?B B   )(-A-Ar(   c                 J    | j         d uo| j        t          t                    v S N)r   r   r   r,   r.   s    r&   is_ec_transfer_instancez(ECTransferConfig.is_ec_transfer_instancea   s$     ,Q&AQAQ1QQr(   c                 J    | j         d uo| j        t          t                    v S r1   )r   r   r   
ECProducerr.   s    r&   is_ec_producerzECTransferConfig.is_ec_producere   $     ,U*AUAU1UUr(   c                 J    | j         d uo| j        t          t                    v S r1   )r   r   r   
ECConsumerr.   s    r&   is_ec_consumerzECTransferConfig.is_ec_consumeri   r6   r(   c                 8    | j                             ||          S r1   )r   get)r#   keydefaults      r&   get_from_extra_configz&ECTransferConfig.get_from_extra_configm   s    -11#w???r(   )r   N)__name__
__module____qualname____doc__r   r    __annotations__r   r   r   floatr   r,   r   intr   r   r   r   dictr   r   r   r'   r/   propertyboolr2   r5   r9   r>    r(   r&   r   r      s         ;:#L#*### !IsTz   )#)cDj)))&  NE2 "GVd]!!!) GS4Z) c* E3DGSF05d0K0K0KtCH~KKK7+/cDj///c    $     R R R R XR V V V V XV V V V V XV@S @ @ @ @ @ @r(   r   )r   r*   dataclassesr   typingr   r   r   pydantic.dataclassesr   vllm.config.utilsr   r4   r8   r,   r   rI   r(   r&   <module>rN      s            ) ) ) ) ) ) ) ) ) ) * * * * * * $ $ $ $ $ $]#
]#
	Z'	( 
[@ [@ [@ [@ [@ [@ [@  [@ [@ [@r(   