§
    .`ƒiÅ	  ã                   ó‚   — d dl mZ d dlmZ d dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZ  G d	„ d
e¦  «        ZdS )é    )Úabstractmethod)ÚIterableN)Ú
VllmConfig)ÚAttentionLayerBase)ÚAttentionBackend)Úget_mamba_attn_backend)ÚKVCacheSpecÚ	MambaSpecc                   ó   — e Zd ZU dZeej        df         ed<   ede	ee
df                  fd„¦   «         Zeedefd„¦   «         ¦   «         Zedeej        df         fd„¦   «         Zdeded	z  fd
„Zdee         fd„Zd	S )Ú	MambaBasez„
    Base class for Mamba-like layers which support the v1 engine.
    Inherit from this class if you implement a custom layer.
    .Úkv_cacheÚreturnc                 ó   — dS )z¾
        Defines the shape of the state.
        For mamba layers this is usually a (conv_state, ssm_state) tuple.
        In this case, returns (conv_state_shape, ssm_state_shape).
        N© ©Úselfs    ú}/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/model_executor/layers/mamba/abstract.pyÚget_state_shapezMambaBase.get_state_shape   s	   € ð 	ˆó    c                 ó   — d S ©Nr   r   s    r   Ú
mamba_typezMambaBase.mamba_type"   s	   € ð 	ˆr   c                 ó   — d S r   r   r   s    r   Úget_state_dtypezMambaBase.get_state_dtype'   s   € àˆr   Úvllm_configNc           	      ó<  — |j         "|j        j        j        dvrt	          d¦  «        ‚|j        j        }|j        j        }t          |  	                    ¦   «         |  
                    ¦   «         ||| j        |j        j        |j         r|j         j        nd¬¦  «        S )N)Ú
qwen3_nextz5Mamba with speculative decoding is not supported yet.r   )ÚshapesÚdtypesÚ
block_sizeÚpage_size_paddedr   Úmamba_cache_modeÚnum_speculative_blocks)Úspeculative_configÚmodel_configÚ	hf_configÚ
model_typeÚNotImplementedErrorÚcache_configÚmamba_block_sizeÚmamba_page_size_paddedr
   r   r   r   r"   Únum_speculative_tokens)r   r   r*   r!   s       r   Úget_kv_cache_speczMambaBase.get_kv_cache_spec+   s²   € àÔ*Ð6ØÔ(Ô2Ô=À^ÐSÐSå%ØGñô ð ð 'Ô3ÔDÐØ&Ô3ÔJÐÝØ×'Ò'Ñ)Ô)Ø×'Ò'Ñ)Ô)Ø'Ø-Ø”Ø(Ô5ÔFð Ô1ðÔ.ÔEÐEàð
ñ 
ô 
ð 	
r   c                 ó*   — t          | j        ¦  «        S )z5Get the attention backend class for this Mamba layer.)r   r   r   s    r   Úget_attn_backendzMambaBase.get_attn_backendC   s   € å% d¤oÑ6Ô6Ð6r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtupleÚtorchÚTensorÚ__annotations__r   r   Úintr   ÚpropertyÚstrr   Údtyper   r   r	   r-   Útyper   r/   r   r   r   r   r      s  € € € € € € ðð ð E”L #Ð%Ô&Ð&Ð&Ñ&àð ¨%°°S°¬/Ô!:ð ð ð ñ „^ðð Øð˜Cð ð ð ñ „^ñ „Xðð ð  u¤{°CÐ'7Ô!8ð ð ð ñ „^ðð
¨Zð 
¸KÈ$Ñ<Nð 
ð 
ð 
ð 
ð07 $Ð'7Ô"8ð 7ð 7ð 7ð 7ð 7ð 7r   r   )Úabcr   Úcollections.abcr   r5   Úvllm.configr   Ú/vllm.model_executor.layers.attention_layer_baser   Úvllm.v1.attention.backendr   Úvllm.v1.attention.selectorr   Úvllm.v1.kv_cache_interfacer	   r
   r   r   r   r   ú<module>rD      sÉ   ðð Ð Ð Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $à €€€à "Ð "Ð "Ð "Ð "Ð "Ø NÐ NÐ NÐ NÐ NÐ NØ 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø =Ð =Ð =Ð =Ð =Ð =Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =ð67ð 67ð 67ð 67ð 67Ð"ñ 67ô 67ð 67ð 67ð 67r   