o
    )i                  	   @   s*  d Z ddlZddlZddlmZm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 dd	lmZ dd
lmZmZmZmZmZ ddlZddlZddlmZ ddlmZ ddlmZm Z  ddl!m"Z" ddl#m$Z$m%Z% erxddl&m'Z' dZ(dZ)de*de*fddZ+eG dd dZ,e-ee.e*e,f   Z/e-e.e*e,f  Z0G dd dej1Z2G dd dej3Z4eG dd dZ5G dd  d ej6d!d!d"Z7G d#d$ d$ej6d!d%Z8G d&d' d'ZG d(d) d)ej6d!d%Z9G d*d+ d+Z:G d,d- d-ej6d!d!d!d.Z;G d/d0 d0ej6d!d!d!d.Z<G d1d2 d2ej6d!d!d3Z=G d4d5 d5eZ>G d6d7 d7ej6d!d!d3Z?G d8d9 d9ej6d!d!d3Z@eG d:d; d;ZAG d<d= d=ej6d!d!d3ZBd>e-e< d?e-e* fd@dAZCd>e-e< d?eDe-e* e.eEeFe* f f fdBdCZGG dDdE dEej6d!d!d"ZHG dFdG dGej6d!d!d"ZIeG dHdI dIZJG dJdK dKeJZKdS )Lz!Sequence and its related classes.    N)ABCabstractmethod)array)defaultdict)Mapping)Sequence)	dataclassfield)reduce)TYPE_CHECKINGAnyCallableOptionalUnion)SingletonInputs)LoRARequest)MultiModalKwargsMultiModalPlaceholderDict)PoolingParams)RequestOutputKindSamplingParams)KVConnectorOutputltoken_idcountc                 C   s   t t| g| S )z)[`array`][] equivalent of [numpy.full][].r   VLLM_TOKEN_ID_ARRAY_TYPE)r   r    r   Y/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/vllm/sequence.py
array_full!   s   r    c                   @   s:   e Zd ZU dZeed< dZee ed< dZ	ee
 ed< dS )LogprobzInfos for supporting OpenAI compatible logprobs and token ranks.

    Attributes:
        logprob: The logprob of chosen token
        rank: The vocab rank of chosen token (>=1)
        decoded_token: The decoded chosen token index
    logprobNrankdecoded_token)__name__
__module____qualname____doc__float__annotations__r#   r   intr$   strr   r   r   r   r!   )   s
   
 r!   c                   @   s`   e Zd ZdZdZdZdZdZdZdZ	dZ
ed	d d
efddZed	d d
eedf fddZdS )SequenceStatuszStatus of a sequence.r                     statusreturnc                 C   s
   | t jkS N)r-   SWAPPEDr4   r   r   r   is_finishedJ      
zSequenceStatus.is_finishedNc                 C   sP   | t jkr	d}|S | t jkrd}|S | t jkrd}|S | t jkr$d}|S d }|S )Nstoplengthabort)r-   FINISHED_STOPPEDFINISHED_LENGTH_CAPPEDFINISHED_ABORTEDFINISHED_IGNORED)r4   Zfinish_reasonr   r   r   get_finished_reasonN   s   




z"SequenceStatus.get_finished_reason)r%   r&   r'   r(   WAITINGRUNNINGr7   r>   r?   r@   rA   staticmethodboolr9   r   r,   rB   r   r   r   r   r-   >   s     r-   c                   @   s   e Zd Ze Ze ZdS )SequenceStageN)r%   r&   r'   enumautoPREFILLDECODEr   r   r   r   rG   `   s    rG   c                   @   s   e Zd ZU dZeed< eed< ee ed< ee ed< ee ed< dZee ed< dZee ed	< dZ	ee ed
< dZ
ee ed< dS )RequestMetricsau  Metrics associated with a request.

    Attributes:
        arrival_time: The time when the request arrived.
        first_scheduled_time: The time when the request was first scheduled.
        first_token_time: The time when the first token was generated.
        time_in_queue: The time the request spent in the queue.
        finished_time: The time when the request was finished.
        scheduler_time: The time spent in the scheduler when this request was
                        being considered by the scheduler.
        model_forward_time: The time spent in the model forward pass when this
                            request was in the batch.
        model_execute_time: The time spent in the model execute function. This
                            will include model forward, block/sync across
                            workers, cpu-gpu sync time and sampling time.
    arrival_timelast_token_timefirst_scheduled_timefirst_token_timetime_in_queueNfinished_timescheduler_timemodel_forward_timemodel_execute_time)r%   r&   r'   r(   r)   r*   r   rR   rS   rT   rU   r   r   r   r   rL   e   s   
 rL   c                   @   s6   e Zd ZU dZee ed< eed< eed< eed< dS )SequenceDataDeltaz/Delta SequenceData to send to workers per step.new_output_token_idsnew_cumulative_logprobnew_num_computed_tokens	new_stageN)	r%   r&   r'   r(   listr+   r*   r)   rG   r   r   r   r   rV      s   
 rV   T)
array_likeomit_defaultsc                   @   s  e Zd ZU dZeed< ejdd dZeed< dZ	e
ej ed< dZe
ej ed	< d
Zeed< ejedZeedf ed< dZeed< dZeed< ejZeed< ejedZee ed< dZe
ej ed< ejedZee ed< dZe
e ed< edeeef dd fddZe	dldddee de
ee  de
ej dd fddZ dmd d!Z!d"d# Z"d$d% Z#e$defd&d'Z%e$deedf fd(d)Z&e&j'dmd*d)Z&e$defd+d,Z(e$deedf fd-d.Z)e)j'd/ee ddfd0d.Z)e$de
ej fd1d2Z*e*j'd3ejddfd4d2Z*e$defd5d6Z+e$de
ej fd7d8Z,e,j'dejddfd9d8Z,e$de
e fd:d;Z-e-j'd<d; Z-	dld=ed>ed?e
ej ddfd@dAZ.defdBdCZ/defdDdEZ0defdFdGZ1dee fdHdIZ2de
ej fdJdKZ3dLedeeedf e
eedf  f fdMdNZ4defdOdPZ5dQefdRdSZ6defdTdUZ7dVefdWdXZ8dmdYdZZ9defd[d\Z:defd]d^Z;deedf fd_d`Z<deedf fdadbZ=de>fdcddZ?dee>fdfdgZ@e$defdhdiZAdeBfdjdkZCdS )nSequenceDataa  Data associated with a sequence.

    Args:
        prompt_token_ids: The token IDs of the prompt.
        output_token_ids: The token IDs of the output. Set to an empty list if
            None.

    Attributes:
        prompt_token_ids: The token IDs of the prompt.
        output_token_ids: The token IDs of the output.
        cumulative_logprob: The cumulative log probability of the output.
    _prompt_token_idsc                   C   s
   t tg S r6   r   r   r   r   r   <lambda>   s   
 zSequenceData.<lambda>default_factory_output_token_idsN_prompt_embeds_output_embeds        _cumulative_logprob._prompt_token_ids_tupler   _num_computed_tokens_num_cached_tokens_stage_cached_all_token_ids_cached_all_token_embeds_new_appended_tokens_mrope_position_deltatoken_countsr5   c                  G   s4   t | dkrtg S ttjdd | D }t|S )z
        Construct a [`SequenceData`][vllm.sequence.SequenceData] instance
        by concatenating prompt token sequences.

        Each tuple represents one token sequence, expressed in the form
        `(token_id, count)`.
        r   c                 s   s    | ]
\}}t ||V  qd S r6   )r    ).0r   r   r   r   r   	<genexpr>   s    z8SequenceData.from_prompt_token_counts.<locals>.<genexpr>)lenr^   	from_seqsr
   r   __iadd__)rp   prompt_token_ids_arrr   r   r   from_prompt_token_counts   s   

z%SequenceData.from_prompt_token_countsprompt_embedsprompt_token_idsoutput_token_idsry   c                C   s6   t t| }|du rt||dS t t|}t|||dS )z
        Construct a [`SequenceData`][vllm.sequence.SequenceData] instance
        from prompt and output token sequences.
        Nrd   )rc   rd   )r   r   r^   )rz   r{   ry   rv   Zoutput_token_ids_arrr   r   r   rt      s   zSequenceData.from_seqsc                 C   sN   | j jdksJ | jjdksJ t| j | _|   | jd ur%|   d S d S )Nr   )r_   typecoderc   tuplerh   _update_cached_all_tokensrd   _update_cached_all_token_embedsselfr   r   r   __post_init__   s   
zSequenceData.__post_init__c                 C   s6   t | jtsJ t | jtsJ t| j| j | _d S r6   )
isinstancer_   r   rc   r[   rl   r   r   r   r   r      s
   z&SequenceData._update_cached_all_tokensc                 C   sD   t | jtjs	J | j| _| jd ur tj| j| jfdd| _d S d S )Nr   dim)r   rd   torchTensorrm   re   catr   r   r   r   r      s   
z,SequenceData._update_cached_all_token_embedsc                 C      | j S r6   )rg   r   r   r   r   cumulative_logprob      zSequenceData.cumulative_logprobc                 C   r   r6   )rh   r   r   r   r   rz     r   zSequenceData.prompt_token_idsc                 C      t r6   NotImplementedError)r   Znew_prompt_token_idsr   r   r   rz        c                 C   r   zReturn the prompt token ids in array type.

        Note that the array is in "I" type, and it is not compatible
        with torch.long (2 bytes vs 4 bytes). So beware of the usage.
        )r_   r   r   r   r   prompt_token_ids_array
  s   z#SequenceData.prompt_token_ids_arrayc                 C   
   t | jS r6   )r~   rc   r   r   r   r   r{     r:   zSequenceData.output_token_idsrW   c                 C   s   t t|| _|   d S r6   )r   r   rc   r   )r   rW   r   r   r   r{     s   c                 C   r   r6   )re   r   r   r   r   output_embeds  r   zSequenceData.output_embedsnew_output_token_embedsc                 C      || _ |   d S r6   )Z_output_token_embedsr   )r   r   r   r   r   r   "     c                 C   s   t | jtsJ | jS r   )r   rc   r   r   r   r   r   output_token_ids_array'  s   z#SequenceData.output_token_ids_arrayc                 C   r   r6   r|   r   r   r   r   ry   1  r   zSequenceData.prompt_embedsc                 C   r   r6   )rd   r   )r   ry   r   r   r   ry   5  r   c                 C   r   r6   ro   r   r   r   r   mrope_position_delta:  r   z!SequenceData.mrope_position_deltac                 C   
   || _ d S r6   r   )r   Znew_mrope_position_deltar   r   r   r   >  r:   r   r"   token_embedc                 C   s   | j | | j| | j| |  j|7  _|d ur[|jdks$J |  d}| j	d u r6|| _	nt
j| j	|fdd| _	| jd usHJ t
j| j|j| jjdfdd| _d S d S )Nr.   r   r   )device)rc   appendrn   rl   rg   ndimdetachcpuZ	unsqueezere   r   r   rm   tor   )r   r   r"   r   r   r   r   append_token_idB  s(   

zSequenceData.append_token_idc                 C   s   t | jt | j S r6   )rs   rc   r_   r   r   r   r   get_lenY     zSequenceData.get_lenc                 C   r   r6   )rs   r_   r   r   r   r   get_prompt_len\     
zSequenceData.get_prompt_lenc                 C   r   r6   )rs   rc   r   r   r   r   get_output_len_  r   zSequenceData.get_output_lenc                 C   r   r6   )rl   r   r   r   r   get_token_idsb     zSequenceData.get_token_idsc                 C   r   r6   )rm   r   r   r   r   get_token_embeddingse  r   z!SequenceData.get_token_embeddings
num_tokensc                 C   s>   |   }||kr| jt| jd||  fS | jd| dfS )z5Get prefix tokens, and make the return value hashableN)r   rh   r~   rc   )r   r   Zprompt_lengthr   r   r   get_prefix_token_idsh  s   z!SequenceData.get_prefix_token_idsc                 C   r   )z>Return the number of prefill tokens that are already computed.)ri   r   r   r   r   get_num_computed_tokenss  r   z$SequenceData.get_num_computed_tokensnum_new_computed_tokensc                 C   sJ   |  j |7  _ | j |  ksJ | j |  f|  dkr#tj| _dS dS )(Update number of tokens computed so far.r   N)ri   r   get_num_uncomputed_tokensrG   rK   rk   )r   r   r   r   r   update_num_computed_tokensw  s   
z'SequenceData.update_num_computed_tokensc                 C   r   )z2Return the number of tokens with prefix cache hit.rj   r   r   r   r   get_num_cached_tokens  r   z"SequenceData.get_num_cached_tokensnum_cached_tokensc                 C   s
   || _ dS )z2Update the number of tokens with prefix cache hit.Nr   )r   r   r   r   r   update_num_cached_tokens  r:   z%SequenceData.update_num_cached_tokensc                 C   s   d| _ tj| _g | _dS )zReset the number of computed tokens from this sequence. It is
        supposed to be called when a sequence needs to be started from
        the beginning again (e.g., sequence is preempted).
        r   N)ri   rG   rJ   rk   rn   r   r   r   r   reset_state_for_recompute  s   
z&SequenceData.reset_state_for_recomputec                 C   s   |   |   S )z:Return the number of prefill tokens that are not computed.)r   r   r   r   r   r   r     s   z&SequenceData.get_num_uncomputed_tokensc                 C   s   | j s| jd S | j d S )Nr   )rc   r_   r   r   r   r   get_last_token_id  s   

zSequenceData.get_last_token_idc                 C   r   r6   )rz   r   r   r   r   get_prompt_token_ids  r   z!SequenceData.get_prompt_token_idsc                 C   r   r6   )r{   r   r   r   r   get_output_token_ids  r   z!SequenceData.get_output_token_idsc                 C   s"   t | j| j|  | j}g | _|S r6   )rV   rn   rg   r   stager   deltar   r   r   get_delta_and_reset  s   
z SequenceData.get_delta_and_resetr   c                 C   s8   |j | _|j| _|j| _| j|j | j	|j d S r6   )
rY   ri   rX   rg   rZ   rk   rc   extendrW   rl   r   r   r   r   apply_delta  s
   zSequenceData.apply_deltac                 C   r   r6   )rk   r   r   r   r   r     r   zSequenceData.stagec                 C   s8   d| j  dt| jdd  d| j d| j d|   dS )NzSequenceData(prompt_token_ids=z, prompt_embeds.shape=shapez, output_token_ids=z, cumulative_logprob=z, get_num_computed_tokens=))r_   getattrrd   r{   r   r   r   r   r   r   __repr__  s   zSequenceData.__repr__r6   r5   N)Dr%   r&   r'   r(   r   r*   msgspecr	   rc   rd   r   r   r   re   rg   r)   r~   rh   r+   ri   rj   rG   rJ   rk   r[   rl   rm   rn   ro   rE   rw   GenericSequencert   r   r   r   propertyr   rz   setterr   r{   r   r   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r,   r   r   r   r   r   r^      s   
 




		


	
	r^   )r]   c                   @   s@  e Zd ZdZ		dKdedededee dee ddfd	d
Ze	defddZ
e	dee fddZe	dee fddZe	dee fddZe	defddZe	defddZe	defddZdededefddZdedeee ef fddZdedefd d!Zdee fd"d#Zdefd$d%Zd&d' Z	dLd(ed)eeef d*ee j! ddfd+d,Z"defd-d.Z#defd/d0Z$defd1d2Z%dee fd3d4Z&de'ed5f fd6d7Z(defd8d9Z)de'ed5f fd:d;Z*de+fd<d=Z,defd>d?Z-d@edd fdAdBZ.defdCdDZ/defdEdFZ0defdGdHZ1defdIdJZ2dS )Mr   a  Stores the data, status, and block information of a sequence.

    The sequence is constructed from the
    [`DecoderOnlyInputs`][vllm.inputs.data.DecoderOnlyInputs] (for decoder-only)
    or [`EncoderDecoderInputs`][vllm.inputs.data.EncoderDecoderInputs]
    (for encoder-decoder) instance passed in through the `inputs`
    constructor argument.

    Args:
        seq_id: The ID of the sequence.
        inputs: The inputs of the sequence.
        block_size: The block size of the sequence. Should be the same as the
            block size used by the block manager and cache engine.
        eos_token_id: The end-of-sequence (EOS) token id recognized by this LLM.
        lora_request: LoRA request.
    Nseq_idinputs
block_sizeeos_token_idlora_requestr5   c                 C   s   || _ || _|| _|| _|| _tj| j| jd dkr| jd nd d| _g | _	d| _
tj| _d | _d| _d| _d| _d| _d | _d S )Ntypeembedsry   rx    r   )r   r   r   r   r   r^   rt   rz   dataoutput_logprobsoutput_textr-   rC   r4   Zstop_reason_last_output_token_ids_offset_last_output_text_offsetZprefix_offsetread_offsettokens)r   r   r   r   r   r   r   r   r   __init__  s(   

zSequence.__init__c                 C   s   |   | j d | j S Nr.   )r   r   r   r   r   r   n_blocks  s   zSequence.n_blocksc                 C   s   | j d dkr	d S | j dS )Nr   r   promptr   getr   r   r   r   r     s   zSequence.promptc                 C   s,   | j d dkrdgt| j d  S | j d S )Nr   r   r   ry   rz   )r   rs   r   r   r   r   rz     s   
zSequence.prompt_token_idsc                 C   s    | j d dkr	g S | j dg S )Nr   r   token_type_idsr   r   r   r   r   r     s   zSequence.token_type_idsc                 C   s   | j d dkr| j d S t S )Nr   
multimodalZ	mm_kwargs)r   r   r   r   r   r   multi_modal_data
  s   
zSequence.multi_modal_datac                 C   s   | j d dkr| j d S i S )Nr   r   Zmm_placeholders)r   r   r   r   r   multi_modal_placeholders  s   
z!Sequence.multi_modal_placeholdersc                 C      | j r| j jS dS Nr   r   lora_int_idr   r   r   r   r        zSequence.lora_int_idbuffer_lengthr   c                 C   sh   |o|    }|s|r| jd|  S | jS t| j}|r!||8 }| j}||k r2|| _| j|| S dS )zVIf delta is True, only new text since the last call to
        this method is returnedNr   )r9   r   rs   r   )r   r   r   truncater<   Zlast_offsetr   r   r   get_output_text_to_return  s   
z"Sequence.get_output_text_to_returnc                 C   sV   |s|   S |  }|| j }|| _|dkr| jjd S |dkr"g S | jj| d S )zYIf delta is True, only new tokens since the last call to
        this method are returnedr.   r   r   N)r   r   r   r   rl   )r   r   Z
output_lenZnum_new_tokensr   r   r   get_output_token_ids_to_return/  s   
z'Sequence.get_output_token_ids_to_returnlogical_idxc                 C   s$   |  |}| j|}t|| jfS r6   )num_hashed_tokens_of_blockr   r   hashr   )r   r   r   Zhashed_tokensr   r   r   hash_of_blockG  s   
zSequence.hash_of_blockc                 C   s   | j dkrdS t| j S )z
        This function computes an extra hash for a sequence, specifically
        designed for prefix caching mode. The final sequence hash is determined
        by applying token_ids from the sequence's blocks.
        r   N)r   r   r   r   r   r   
extra_hashQ  s   

zSequence.extra_hashc                 C   s   || j  | j  S r6   )r   )r   r   r   r   r   r   ^     z#Sequence.num_hashed_tokens_of_blockc                 C   s   | j   dS )z,Reset the sequence states for recomputation.N)r   r   r   r   r   r   r   a  s   z"Sequence.reset_state_for_recomputer   logprobsr   c                 C   s2   ||v sJ | j | | j||| j| d S r6   )r   r   r   r   r"   )r   r   r   r   r   r   r   r   e  s
   zSequence.append_token_idc                 C   
   | j  S r6   )r   r   r   r   r   r   r   n  r   zSequence.get_lenc                 C   r   r6   )r   r   r   r   r   r   r   q  r   zSequence.get_prompt_lenc                 C   r   r6   )r   r   r   r   r   r   r   t  r   zSequence.get_output_lenc                 C   r   r6   )r   r   r   r   r   r   r   w  r   zSequence.get_token_ids.c                 C   r   r6   )r   r   r   r   r   r   r   z  r   zSequence.get_prompt_token_idsc                 C   r   r6   )r   r   r   r   r   r   r   }  r   zSequence.get_last_token_idc                 C   r   r6   )r   r   r   r   r   r   r     r   zSequence.get_output_token_idsc                 C      | j jS r6   )r   r   r   r   r   r   get_cumulative_logprob  s   zSequence.get_cumulative_logprobc                 C   s   t | jS r6   )r-   r9   r4   r   r   r   r   r9        zSequence.is_finished
new_seq_idc                 C   s   t | }||_|S r6   )copydeepcopyr   )r   r   Znew_seqr   r   r   fork  s   
zSequence.forkc                 C   s   | j jtjkr	dS | j  S )zGet the number of new tokens to be computed.

        Returns:
            The new number of tokens to be computed. I.e., 1 for decode, or
            the remaining prompt size for prefill.
        r.   )r   r   rG   rK   r   r   r   r   r   get_num_new_tokens  s   
zSequence.get_num_new_tokensc                 C   r   r6   )r   r   r   r   r   r   r     r   z Sequence.get_num_computed_tokensc                 C   s   | j jtjkS r6   )r   r   rG   rJ   r   r   r   r   
is_prefill     zSequence.is_prefillc                 C   s    d| j  d| jj d| j dS )NzSequence(seq_id=z	, status=z, num_blocks=r   )r   r4   namer   r   r   r   r   r     s
   
zSequence.__repr__)NNr6   )3r%   r&   r'   r(   r+   r   r   r   r   r   r   r,   r   r[   rz   r   r   r   r   r   r   rF   r   r   r   r   r   r   r   r   dictr!   r   r   r   r   r   r   r   r~   r   r   r   r)   r   r9   r   r   r   r   r   r   r   r   r   r     s    
"




	r   c                   @   s<   e Zd ZU dZdZeed< dZeed< edefddZ	d	S )
SequenceGroupStatez/Mutable state tied to a specific sequence groupr.   	num_stepsr   current_stepr5   c                 C   s   | j | j S r6   )r  r  r   r   r   r   remaining_steps     z"SequenceGroupState.remaining_stepsN)
r%   r&   r'   r(   r  r+   r*   r  r   r  r   r   r   r   r     s   
 r   c                   @   s`  e Zd ZdZ								dKdedee dedee	 d	ee
 d
ee deej dee deeeef  dededdfddZedee fddZedee fddZedee fddZedeee  fddZedeee  fddZedefddZedefdd Zedefd!d"Zd#eddfd$d%Zdefd&d'Zd(eddfd)d*Zd(eddfd+d,Zd(ee ddfd-d.Z defd/d0Z!	dLd1ee" dee fd2d3Z#de$fd4d5Z%dee fd6d7Z&dee fd8d9Z'd:efd;d<Z(defd=d>Z)dLd1ee" defd?d@Z*defdAdBZ+de$fdCdDZ,de$fdEdFZ-defdGdHZ.de$fdIdJZ/dS )MSequenceGroupa   A group of sequences that are generated from the same prompt.

    Args:
        request_id: The ID of the request.
        seqs: The list of sequences.
        sampling_params: The sampling parameters used to generate the outputs.
        arrival_time: The arrival time of the request.
        lora_request: LoRA request.
        pooling_params: The parameters used to generate the pooler
            for a pooling model.
        pooled_data: The extracted hidden states from a pooling model.
        encoder_seq: Optional, the single encoder sequence. Should be None
                     unless you are working with an encoder/decoder model.
        trace_headers: OpenTelemetry trace headers.
        priority: User-defined priority of the request.
        draft_size: The number of speculative tokens plus one from the target
                    model; equal to max number of tokens a step can generate
                    for single-draft speculative decoding but larger than
                    that for multi-draft SD (currently not supported).
    Nr   r.   
request_idseqsrM   sampling_paramsr   pooling_paramspooled_dataencoder_seqtrace_headerspriority
draft_sizer5   c                 C   s   || _ || _|d | _|| _t|dk| _dd |D | _|| _t||d d d d| _	d| _
|| _d | _t | _|| _|| _|| _|	| _|
| _d | _d S )Nr   r.   c                 S   s   i | ]}|j |qS r   )r   rq   seqr   r   r   
<dictcomp>  s    z*SequenceGroup.__init__.<locals>.<dictcomp>)rM   rN   rO   rP   rQ   rf   )r  r  	first_seqrM   rs   is_single_seqZ	seqs_dictr  rL   metricslast_token_latencyr   prompt_logprobsr   stater	  r
  r  r  r  Zcached_request_output)r   r  r  rM   r  r   r	  r
  r  r  r  r  r   r   r   r     s.   

zSequenceGroup.__init__c                 C   r   r6   )r  r   r   r   r   r   r        zSequenceGroup.promptc                 C   r   r6   )r  rz   r   r   r   r   rz     r  zSequenceGroup.prompt_token_idsc                 C      | j d ur	| j jS d S r6   )r  r   r   r   r   r   encoder_prompt     
zSequenceGroup.encoder_promptc                 C   r  r6   )r  rz   r   r   r   r   encoder_prompt_token_ids  r  z&SequenceGroup.encoder_prompt_token_idsc                 C   r   r6   )r  r   r   r   r   r   r     r  zSequenceGroup.token_type_idsc                 C   s(   | j jr| j jS | jd ur| jjS t S r6   )r  r   r  r   r   r   r   r   r   	  s
   
zSequenceGroup.multi_modal_datac                 C   s&   | j jr| j jS | jd ur| jjS i S r6   )r  r   r   r  r   r   r   r   r     s
   
z&SequenceGroup.multi_modal_placeholdersc                 C   r   r   r   r   r   r   r   r     r   zSequenceGroup.lora_int_idnowc                 C   s*   |   rJ d|| jj | _|| j_dS )z3Sets the last token time for Request level timings.zZseq_group.set_last_token_time() should not be called if the seq_group is in prefill phase.N)r   r  rN   r  )r   r  r   r   r   set_last_token_time  s
   
z!SequenceGroup.set_last_token_timec                 C   s   |   rJ d| jS )z&Returns the latency of the last token.z]seq_group.get_last_token_latency() should not be called if the seq_group is in prefill phase.)r   r  r   r   r   r   get_last_token_latency&  s   
z$SequenceGroup.get_last_token_latencytimec                 C   s.   | j jdu r| j dkr|| j _dS dS dS )z4Sets the first token time for Request level timings.Nr.   )r  rP   r  r   r   r   r   r   r   maybe_set_first_token_time-  s
   z(SequenceGroup.maybe_set_first_token_timec                 C   s,   | j jdu r|| j _|| j j | j _dS dS )zRSets the first scheduled time and time in queue for Request
        level timings.N)r  rO   rM   rQ   r!  r   r   r   maybe_set_first_scheduled_time7  s   z,SequenceGroup.maybe_set_first_scheduled_timec                 C   s   || j _dS )z1Sets the finished time for Request level timings.N)r  rR   r!  r   r   r   set_finished_time>  r  zSequenceGroup.set_finished_timec                 C   s(   | j r| j r
dS dS |  |   S )zeThe maximum number of sequences running in parallel in the remaining
        lifetime of the request.r   r.   )r  r  r9   num_seqsnum_finished_seqsr   r   r   r   get_max_num_running_seqsB  s   z&SequenceGroup.get_max_num_running_seqsr4   c                    s>    d u r| j S | jr| jj kr| j S g S  fdd| j D S )Nc                    s   g | ]	}|j  kr|qS r   r8   r  r8   r   r   
<listcomp>S      z*SequenceGroup.get_seqs.<locals>.<listcomp>)r  r  r  r4   r   r4   r   r8   r   get_seqsI  s
   zSequenceGroup.get_seqsc                 C   s
   | j d uS r6   r  r   r   r   r   is_encoder_decoderU  r   z SequenceGroup.is_encoder_decoderc                 C   r   r6   r,  r   r   r   r   get_encoder_seqX  r   zSequenceGroup.get_encoder_seqc                 C   s*   | j r| j r| jS g S dd | jD S )Nc                 S   s   g | ]}|  r|qS r   r9   r  r   r   r   r(  _      z3SequenceGroup.get_finished_seqs.<locals>.<listcomp>)r  r  r9   r  r   r   r   r   get_finished_seqs[  s   zSequenceGroup.get_finished_seqsr   c                 C   s$   | j D ]}| s|j| qdS )r   N)r  r9   r   r   )r   r   r  r   r   r   r   a  s
   
z(SequenceGroup.update_num_computed_tokensc                 C   s*   d}| j D ]}| s||j 7 }q|S r   )r  r9   r   r   )r   Znum_uncomputed_tokensr  r   r   r   r   g  s   
z'SequenceGroup.get_num_uncomputed_tokensc                 C   s>   |d u r	t | jS | jr| jd j|krdS dS t | |S Nr   r.   )rs   r  r  r4   r+  r*  r   r   r   r%  n  s
   
zSequenceGroup.num_seqsc                 C   s(   | j r| jd  rdS dS t|  S r2  )r  r  r9   rs   r1  r   r   r   r   r&  y  s   zSequenceGroup.num_finished_seqsc                 C   s$   | j r| j S tdd | jD S )Nc                 s       | ]}|  V  qd S r6   r/  r  r   r   r   rr         z,SequenceGroup.is_finished.<locals>.<genexpr>)r  r  r9   allr  r   r   r   r   r9   ~  s   
zSequenceGroup.is_finishedc                 C   r   r6   )r  r   r   r   r   r   r     r   zSequenceGroup.is_prefillc                 C   s"   d| j  d| j dt| j dS )NzSequenceGroup(request_id=z, sampling_params=z, num_seqs=r   )r  r  rs   r  r   r   r   r   r     s
   
zSequenceGroup.__repr__c                 C      t dd | jD S )z5Returns True if the sequence group uses input embeds.c                 s   s    | ]	}|j jd uV  qd S r6   )r   ry   r  r   r   r   rr     s    z3SequenceGroup.uses_prompt_embeds.<locals>.<genexpr>)anyr  r   r   r   r   uses_prompt_embeds  s   z SequenceGroup.uses_prompt_embeds)NNNNNNr   r.   r6   )0r%   r&   r'   r(   r,   r[   r   r)   r   r   r   r   r   r   r   r+   r   r   r   rz   r  r  r   r   r   r   r   r   r  r  r"  r#  r$  r'  r-   r+  rF   r-  r.  r1  r   r   r%  r&  r9   r   r   r8  r   r   r   r   r    s    	

%	
	
r  c                   @   s   e Zd ZU dZeeef ed< eed< eee	e f ed< e
ed< dZe
ed< dZee ed	< dZee	e  ed
< ejdd dZee ed< dS )SequenceGroupMetadataDeltazDelta of SequenceGroupMetadata.

    After sending the first SequenceGroupMetadata, vLLM scheduler
    only sends delta to reduce the data payload size.
    seq_data_deltar  block_tables	is_promptT	do_sampleNtoken_chunk_sizecomputed_block_numsc                   C      t  S r6   r   r   r   r   r   r`         z#SequenceGroupMetadataDelta.<lambda>ra   r  )r%   r&   r'   r(   r   r+   rV   r*   r,   r[   rF   r=  r>  r   r?  r   r	   r  r   r   r   r   r   r9    s   
 r9  )tagr\   r]   c                   @   sx  e Zd ZU dZeed< eed< eee	f ed< e
e ed< eeee f ed< dZeed< d	Ze
e ed
< d	Ze
e ed< d	Ze
ee  ed< ejdd dZe
e ed< d	Ze
ee  ed< d	Ze
e ed< d	Ze
e ed< d	Ze
e	 ed< d	Ze
ee  ed< d	Ze
e ed< d	Ze
e ed< dd Z e!defddZ"e!defddZ#defdd Z$d!e%fd"d#Z&d&d$d%Z'd	S )'SequenceGroupMetadataag  Metadata for a sequence group. Used to create `AttentionMetadata`.

    Args:
        request_id: The ID of the request.
        is_prompt: Whether the request is at prompt stage.
        seq_data: The sequence data. (Seq id -> sequence data)
        sampling_params: The sampling parameters used to generate the outputs.
        block_tables: The block tables. (Seq id -> list of physical block
            numbers)
        do_sample: True if sampling is required. Sampling is not required when
            e.g., prefill is chunked, and the current iteration only computes
            query tokens for prefill, we don't need sampling.
        token_chunk_size: The number of tokens to be processed (per sequence).
            None if chunking is not required.
        lora_request: LoRA request.
        computed_block_nums: The block numbers that are already computed,
            used in prefix caching.
        state: Internal state tied to this sequence group.
        multi_modal_data: Multi modal data.
        mm_processor_kwargs: Multimodal input processor / mapper overrides.
        encoder_seq_data: Optional sequence data for encoder prompt
                          (SequenceGroup.encoder_seq). Should be None
                          unless you are working with an encoder/decoder
                          model.
        cross_block_table: Optional cross-attention block table associated
                           with the encoder prompt
                           (SequenceGroup.encoder_seq). Should be None
                           unless you are working with an encoder/decoder
                           model.
    r  r<  seq_datar  r;  Tr=  Nr	  r   r?  c                   C   r@  r6   rA  r   r   r   r   r`     rB  zSequenceGroupMetadata.<lambda>ra   r  r   r   r   encoder_seq_datacross_block_tabler>  num_speculative_tokensc                 C   sH   | j d ur | jd u r"| jrtt| j   | _d S d| _d S d S d S r   )rE  r>  r<  nextitervaluesr   r   r   r   r   r     s   
z#SequenceGroupMetadata.__post_init__r5   c                 C   r   r   r   r   r   r   r   r     r   z!SequenceGroupMetadata.lora_int_idc                 C   s   | j o| jS r6   )r<  r=  r   r   r   r   is_single_step_prompt  s   z+SequenceGroupMetadata.is_single_step_promptc                 C   s   t t| jS r6   )rI  rJ  rE  r   r   r   r   get_first_seq_id  s   z&SequenceGroupMetadata.get_first_seq_idsequence_group_metadata_deltac                 C   sX   |j  D ]\}}| j| | q| j|jksJ |j| _|j| _|j| _|j| _d S r6   )	r:  itemsrE  r   r  r;  r>  r=  r<  )r   rN  idr   r   r   r   r     s   z!SequenceGroupMetadata.apply_deltac                 C   sN   | j d usJ | j j| j jk sJ d| j j d| j j | j  jd7  _d S )Nzcurrent step z, num_steps r.   )r  r  r  r   r   r   r   finish_step  s
   z!SequenceGroupMetadata.finish_stepr   )(r%   r&   r'   r(   r,   r*   rF   r   r+   r^   r   r   r[   r=  r	  r   r   r   r?  r   r	   r  r   r   r   r   r   r   rF  rG  r>  rH  r   r   r   rL  rM  r9  r   rQ  r   r   r   r   rD    s>   
 

rD  c                   @   sd   e Zd ZU dZeed< eed< eeef ed< dZe	e
j ed< defdd	Zd
edefddZdS )SequenceOutputa0  The model output associated with a sequence.

    Args:
        parent_seq_id: The ID of the parent sequence (for forking in beam
            search).
        output_token: The output token ID.
        logprobs: The logprobs of the output token.
            (Token id -> logP(x_i+1 | x_0, ..., x_i))
    parent_seq_idoutput_tokenr   Noutput_embedr5   c              	   C   s:   | j d ur	| j jnd }d| j d| j d| d| j d	S )NzSequenceOutput(parent_seq_id=z, output_token=z, output_embed.shape=z, logprobs=r   )rU  r   rS  rT  r   )r   Zoutput_embed_shaper   r   r   r     s   
zSequenceOutput.__repr__otherc                 C   s<   t |tst | j|jko| j|jk}|j| jk}|o|S r6   )r   rR  r   rS  rT  r   )r   rV  equalZlog_probs_equalr   r   r   __eq__'  s   

zSequenceOutput.__eq__)r%   r&   r'   r(   r+   r*   r   r!   rU  r   r   r   r,   r   objectrF   rX  r   r   r   r   rR    s   
 	rR  )r]   r\   c                   @   s8   e Zd ZdZedefddZededefddZ	dS )	SequenceGroupOutputzBThe base class for model outputs associated with a sequence group.r5   c                 C      d S r6   r   r   r   r   r   r   3  r   zSequenceGroupOutput.__repr__rV  c                 C   r[  r6   r   r   rV  r   r   r   rX  7  r   zSequenceGroupOutput.__eq__N)
r%   r&   r'   r(   r   r,   r   rY  rF   rX  r   r   r   r   rZ  0  s    rZ  c                   @   s^   e Zd ZU dZeZee ed< e	e
 ed< dZe	e ed< defddZd	edefd
dZdS )CompletionSequenceGroupOutputz=The model output associated with a completion sequence group.samplesr  r   
step_indexr5   c                 C   s   d| j  d| j dS )Nz&CompletionSequenceGroupOutput(samples=z, prompt_logprobs=r   )r^  r  r   r   r   r   r   G  s   
z&CompletionSequenceGroupOutput.__repr__rV  c                 C   s(   t |tst | j|jko| j|jkS r6   )r   r]  r   r^  r  r\  r   r   r   rX  K  s
   

z$CompletionSequenceGroupOutput.__eq__N)r%   r&   r'   r(   rZ  __metaclass__r[   rR  r*   r   PromptLogprobsr_  r+   r,   r   rY  rF   rX  r   r   r   r   r]  <  s   
 r]  c                   @   sL   e Zd ZU dZeZeed< defddZ	de
fddZdedefd	d
ZdS )PoolingSequenceGroupOutputz:The model output associated with a pooling sequence group.r   r5   c                 C   s   | j }|jS r6   )r   nbytes)r   r   r   r   r   get_data_nbytes]  s   z*PoolingSequenceGroupOutput.get_data_nbytesc                 C   s   d| j  S )Nz PoolingSequenceGroupOutput(data=)r   r   r   r   r   r   a  r   z#PoolingSequenceGroupOutput.__repr__rV  c                 C   s   t |tst | j|jkS r6   )r   rb  r   r   r\  r   r   r   rX  d  s   
z!PoolingSequenceGroupOutput.__eq__N)r%   r&   r'   r(   rZ  r`  r   r*   r+   rd  r,   r   rY  rF   rX  r   r   r   r   rb  R  s   
 rb  c                   @   s   e Zd ZU dZeeejf ed< e	d ed< dd Z
deeef fdd	Zded
ejfddZdd Zdd ZdefddZdefddZdS )IntermediateTensorsa  For all pipeline stages except the last, we need to return the hidden
    states and residuals to be sent to the next stage. This data structure
    contains the hidden states and residuals for a request.
    
    Each stage also needs to handle its own kv_connector_output.
    tensorsr   Zkv_connector_outputc                 C   r   r6   rf  )r   rf  r   r   r   r   w  s   
zIntermediateTensors.__init__keyc                    s@   t  tr
| j  S t  tr|  fdd| j D S d S )Nc                    s   i | ]	\}}||  qS r   r   )rq   kvrh  r   r   r    r)  z3IntermediateTensors.__getitem__.<locals>.<dictcomp>)r   r,   rf  slice	__class__rO  )r   rh  r   rk  r   __getitem__~  s
   


zIntermediateTensors.__getitem__valuec                 C      || j |< d S r6   rg  )r   rh  ro  r   r   r   __setitem__  r   zIntermediateTensors.__setitem__c                 C   r   r6   )rf  rO  r   r   r   r   rO    r   zIntermediateTensors.itemsc                 C   r   r6   )rs   rf  r   r   r   r   __len__  r   zIntermediateTensors.__len__rV  c                 C   s   t || jo| S r6   )r   rm  r\  r   r   r   rX    r   zIntermediateTensors.__eq__r5   c                 C   s   d| j  dS )NzIntermediateTensors(tensors=r   rg  r   r   r   r   r     r   zIntermediateTensors.__repr__N)r%   r&   r'   r(   r   r,   r   r   r*   r   r   r   rl  rn  rq  rO  rr  rY  rX  r   r   r   r   r   re  k  s   
 re  c                   @   sf   e Zd ZU dZee ed< defddZdedefddZ	ded	efd
dZ
dd ZdefddZdS )PoolerOutputz9The output from a pooling operation in the pooling model.outputsr5   c                 C   r6  )Nc                 s   r3  r6   )rd  )rq   or   r   r   rr     r4  z/PoolerOutput.get_data_nbytes.<locals>.<genexpr>)sumrt  r   r   r   r   rd    r   zPoolerOutput.get_data_nbytesidxc                 C   s
   | j | S r6   rt  )r   rw  r   r   r   rn    r   zPoolerOutput.__getitem__ro  c                 C   rp  r6   rx  )r   rw  ro  r   r   r   rq    r   zPoolerOutput.__setitem__c                 C   r   r6   )rs   rt  r   r   r   r   rr    r   zPoolerOutput.__len__rV  c                 C   s   t || jo| j|jkS r6   )r   rm  rt  r\  r   r   r   rX    s
   
zPoolerOutput.__eq__N)r%   r&   r'   r(   r[   rb  r*   r+   rd  rn  rq  rr  rY  rX  r   r   r   r   rs    s   
 rs  seq_group_metadata_listr5   c                 C   s   dd | D S )RGiven a list of SequenceGroupMetadata, create a list of all
    sequence ids.
    c                 S   s   g | ]
}|j D ]}|qqS r   )rE  )rq   sgr   r   r   r   r(    s    z#get_all_seq_ids.<locals>.<listcomp>r   )ry  r   r   r   get_all_seq_ids  s   r|  c                 C   sD   g }t t}| D ]}|jD ]}|| ||j | qq||fS )rz  )r   setrE  r   r  add)ry  seq_idsZrequest_id_seq_ids_mappingr{  r   r   r   r   get_all_seq_ids_and_request_ids  s   

r  c                   @   s   e Zd ZU dZejed< dZee	e
  ed< dZeej ed< eje	dZe	e ed< dd	 Zed
e	e fddZ	ddejde	e
 deej fddZde	e
 d
dfddZded
dfddZdS )HiddenStatesa  Hidden states corresponding to in-progress sequences.
    Used in speculative decoding to pass hidden states from
    the target model to the proposer model.

    seq_ids are the sequence ids of each entry of the batch
    dimension of the hidden_states tensorhidden_statesNry  second_last_token_hidden_statesra   _seq_idsc                 C   s6   | j d urt| j t| jksJ t| j | _d S d S r6   )ry  rs   r  r|  r  r   r   r   r   r     s   
zHiddenStates.__post_init__r5   c                 C   r   r6   r  r   r   r   r   r    r   zHiddenStates.seq_idsc                 C   sl   t |t |ks
J | jt| t| j|g| _| jdur4t| j|du r-t|n|g| _dS dS )zUUpdate hidden states from target model invocation. Only used for
        decode stepsN)	rs   r  r   r|  r   r   r  r  Z
zeros_like)r   r  ry  r  r   r   r   update  s   

zHiddenStates.updatec                    sf   t |} fdd|D }| jkr1 fdd|D } j|  _ jdur, j|  _| _dS dS )zLPrune to provided list of sequence ids. Only used for decode steps.
        c                    s   g | ]	}| j v r|qS r   r  rq   r   r   r   r   r(    r)  z&HiddenStates.prune.<locals>.<listcomp>c                    s   g | ]} j |qS r   )r  indexr  r   r   r   r(    r0  N)r|  r  r  r  )r   ry  r  r  r   r   r   prune  s   


zHiddenStates.prune!seq_with_bonus_token_in_last_stepc                 C   sp   | j du s|s	dS g }| jD ]}| j|}||v r$||t| j  || qt| j| j g| | _dS )zExpand hidden states for sequences with bonus tokens. This is in
        alignment with `MultiStepWorker._expand_execute_model_request`.N)r  r  r  r   rs   r   r   r  )r   r  r  r   ir   r   r   expand_with_bonus_tokens  s   



z%HiddenStates.expand_with_bonus_tokensr6   )r%   r&   r'   r(   r   r   r*   ry  r   r[   rD  r  r   r	   r  r+   r   r   r  r  r  r}  r  r   r   r   r   r    s6   
 


r  c                   @   sB  e Zd ZU dZeeeef  ed< e	j
edZeeeef  ed< e	j
edZeeeef  ed< e	j
edZeeeef  ed< dZeed< dZeed	< dZeed
< dZee ed< dZeed< e	j
edZee ed< dZeej ed< dZee ed< edefddZ edefddZ!deeeef  dd fddZ"dS )ExecuteModelRequestzThe model execution request, containing CPU metadata only. The LLM
    engine should create an instance of this class for each request batch.ry  ra   blocks_to_swap_inblocks_to_swap_outblocks_to_copyr   virtual_enginenum_lookahead_slotsrunning_queue_sizeNprevious_hidden_statesr.   r  finished_requests_idslast_sampled_token_idsasync_callbackr5   c                 C   s6   t | jdks	J | jd }|jd usJ |jjdkS r2  )rs   ry  r  r  )r   Zfirst_seq_groupr   r   r   is_last_step=  s   
z ExecuteModelRequest.is_last_stepc                 C   s0   t | jdks	J | jd j}|d usJ |jS r   )rs   ry  r  r  )r   r  r   r   r   r  F  s   z ExecuteModelRequest.current_stepc                 C   sT   t || j | j | j | j| j| j| j| j	| j
| jdur$| j nd| jdS )z:Clone the request with a new sequence group metadata list.N)ry  r  r  r  r  r  r  r  r  r  r  r  )r  r  r   r  r  r  r  r  r  r  r  r  cloner  )r   ry  r   r   r   r  O  s    

zExecuteModelRequest.clone)#r%   r&   r'   r(   r[   r   rD  r9  r*   r   r	   r  r~   r+   r  r  r  r  r  r  r   r  r  r  r,   r  r   r   r  r   r   rF   r  r  r  r   r   r   r   r    sB   
 

 r  c                   @   s   e Zd ZU eed< dZee ed< ee	dZ
e	eef ed< ee	dZe	eef ed< ee	dZe	eef ed< dZeed	< dZeed
< edefddZdefddZdedee fddZdS )SequenceGroupBaseZgroup_idNassembled_seq_groupra   seq_id_to_indexto_be_finishedfinished_reqsF	streamingoutput_producedr  c                 O   r   )zWhen we are ready to add a request with request_id and params
        into the engine, we can split the request into multiple requests.
        r   )r  engineparamsargskwargsr   r   r   add_requestw     zSequenceGroupBase.add_requestr  c                 C   s   | j |j= || j|j< dS )zGThe sequence `seq` finishes, we should record the information.
        N)r  r  r  )r   r  r   r   r   
finish_seq~  s   
zSequenceGroupBase.finish_seq	seq_groupr5   c                 C   r   )ztAssemble the sequence group, for producing the final
        output, or adding request in the engine again.
        r   )r   r  r   r   r   maybe_assemble_group  r  z&SequenceGroupBase.maybe_assemble_group)r%   r&   r'   r,   r*   r  r   r  r	   r   r  r+   r  r  r  rF   r  rE   r  r  r  r   r   r   r   r  d  s    
 r  c                   @   s4   e Zd ZedefddZdedee fddZdS )	ParallelSampleSequenceGroupr  c           
      K   s   |}t | }g }t|jD ]D}|  d| }||j|< | }d|_|jd ur.| j|7  _|j|fd|i|}	|	d us?J ||j|< |	|j|< |	|	j
d  qt| ||	j||	j|	j|	j|	j|	j|	jd
|_|jtjk|_d|_d S )NZ_parallel_sample_r.   r  r   )
r  r  rM   r  r   r	  r
  r  r  r  F)r  rangenr  r  seedZ_add_processed_requestZseq_id_to_seq_groupr  r   r  r  rM   r   r	  r
  r  r  r  r  Zoutput_kindr   ZDELTAr  r  )
r  r  r  r  Zoriginal_paramsgroupr  r  Zrequest_id_ir  r   r   r   r    sF   




z'ParallelSampleSequenceGroup.add_requestr  r5   c           	      C   s   | j rtt| j}|j|kr| jS d S t| jdkri|j| jv ri| ri| jd us,J | jj}t	|t
s7J | jsdd| _|jd ura|jpG|j}| jj}dd }t||dd}|d | }|| j_| jS | jrid S d S )Nr.   Tc                 S   s   |   S r6   )r   )r  r   r   r   r`     s    zBParallelSampleSequenceGroup.maybe_assemble_group.<locals>.<lambda>)rh  reverse)r  rI  rJ  r  r  r  rs   r9   r  r   r   r  Z_real_nr  r  sorted)	r   r  Zfirst_remaining_idr  r  r  Zsorting_keyZsorted_seqsZ
top_n_seqsr   r   r   r    s2   

z0ParallelSampleSequenceGroup.maybe_assemble_groupN)	r%   r&   r'   rE   r,   r  r  r   r  r   r   r   r   r    s    (r  )Lr(   r   rH   abcr   r   r   collectionsr   collections.abcr   r   r   dataclassesr   r	   	functoolsr
   typingr   r   r   r   r   r   r   Zvllm.inputsr   Zvllm.lora.requestr   Zvllm.multimodalr   r   Zvllm.pooling_paramsr   Zvllm.sampling_paramsr   r   Z.vllm.v1.worker.kv_connector_model_runner_mixinr   r   ZVLLM_INVALID_TOKEN_IDr+   r    r!   r[   r   ra  ZSampleLogprobsIntEnumr-   EnumrG   rL   StructrV   r^   r   r  r9  rD  rR  rZ  r]  rb  re  rs  r|  r~   r,   r}  r  r  r  r  r  r   r   r   r   <module>   s   "
  1 f 
_

h#


(


XI'