
    -`i                     @   d dl mZmZmZ d dlZd dlmZ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 erd d	lmZ d d
lmZ neZeZ ee          Zed         Zed         Zed         Ze e
 ed                     G d d                                  ZdS )    )TYPE_CHECKINGAnyLiteralN)
ConfigDictFieldmodel_validator)	dataclass)Self)config)init_logger)	safe_hash)ModelConfig)CacheConfig)autofloat16bfloat16)	             @         i@     )r   r   T)arbitrary_types_allowedc                      e Zd ZU dZdZeed<   	  edd          Ze	ed<   	 dZ
eed<   	 d	Ze	d	z  ed
<   	 dZej        ez  ed<   	 d	Zeeef         d	z  ed<   	 dZeed<   	 defdZ ed          defd            ZdefdZd	S )
LoRAConfigzConfiguration for LoRA.r   max_lora_rankr   )defaultge	max_lorasFfully_sharded_lorasNmax_cpu_lorasr   
lora_dtypedefault_mm_lorasenable_tower_connector_lorareturnc                    g }|                     | j                   |                     | j                   |                     | j                   |                     | j                   |                     | j                   t          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)
appendr   r!   r"   r$   r&   r   strencode	hexdigest)selffactorshash_strs      d/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/config/lora.pycompute_hashzLoRAConfig.compute_hash@   s      t)***t~&&&t/000t'''t7888S\\0022EJJJTTVV    after)modec                     | j         | j        | _         n0| j         | j        k     r t          d| j          d| j         d          | S )Nzmax_cpu_loras (z) must be >= max_loras (z).)r#   r!   
ValueError)r.   s    r1   _validate_lora_configz LoRAConfig._validate_lora_configV   si    %!%D$.001$"4 1 1"n1 1 1  
 r3   model_configc                     | j         dv r|j        | _         d S t          | j         t                    r!t	          t
          | j                   | _         d S d S )N)Nr   )r$   dtype
isinstancer+   getattrtorch)r.   r9   s     r1   verify_with_model_configz#LoRAConfig.verify_with_model_configb   sR    ?n,,*0DOOO-- 	>%eT_==DOOO	> 	>r3   )__name__
__module____qualname____doc__r   MaxLoRARanks__annotations__r   r!   intr"   boolr#   r$   r>   r;   	LoRADTyper%   dictr+   r&   r2   r   r
   r8   r   r?    r3   r1   r   r      sD         "!"$M<$$$U1+++Is+++0 %%%% !%M3:$$$*0Ji'000H.2d38nt+222 ).---
c    , _'"""	t 	 	 	 #"	>[ > > > > > >r3   r   )typingr   r   r   r>   pydanticr   r   r   pydantic.dataclassesr	   typing_extensionsr
   vllm.config.utilsr   vllm.loggerr   vllm.utils.hashingr   vllm.configr   vllm.config.cacher   r@   loggerrH   rD   LoRAExtraVocabSizer   rJ   r3   r1   <module>rV      s|   / . . . . . . . . .  7 7 7 7 7 7 7 7 7 7 * * * * * * " " " " " " $ $ $ $ $ $ # # # # # # ( ( ( ( ( ( ''''''-------KK	X		12	;<X&  
**T:::;;;G> G> G> G> G> G> G> <; G> G> G>r3   