
    *`i                     h    d dl mZ d dlmZ d dlmZ ddgZ G d de          Z G d d          ZdS )	    )Enum)delete_offload_parameter)ModuleQuantizationMetadataKVCacheScaleTypec                       e Zd ZdZdZdS )r   k_scalev_scaleN)__name__
__module____qualname__KEYVALUE     /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/compressed_tensors/quantization/quant_metadata.pyr   r      s        
CEEEr   c                   D    e Zd ZdZed             Zedefd            ZdS )r   z>
    Container class for metadata related to quantization
    c                  `    t           j        j        t           j        j        gd dD             z   S )z
        All quantization parameter names that might be registered
        onto a module during lifecycle (excluding serialized parameters)
        c                 &    g | ]}d D ]	}| d| 
S ))global_scalescale
zero_pointg_idx_r   ).0	base_namesuffixs      r   
<listcomp>z9QuantizationMetadata.all_qparam_names.<locals>.<listcomp>(   sX     	M
 	M
 	M
	M
 	M
  ##6##	M
 	M
 	M
 	M
r   )inputweightoutput)r   r   valuer   r   r   r   all_qparam_namesz%QuantizationMetadata.all_qparam_names"   sD     !$*,<,B,HI 	M
 	M
:	M
 	M
 	M
 	
 		
r   modulec                 t    |                                  D ]"}t          ||          rt          ||           #dS )z
        Remove all parameters related to quantization that might have
        been registered onto a module previously in lifecycle (excluding
        serialized parameters)

        :param module: Module to clear
        N)r#   hasattrr   )clsr$   keys      r   clear_all_qparamsz&QuantizationMetadata.clear_all_qparams3   sL     '')) 	6 	6Cvs## 6(555	6 	6r   N)	r   r   r   __doc__staticmethodr#   classmethodr   r)   r   r   r   r   r      s`          
 
 \
  
6v 
6 
6 
6 [
6 
6 
6r   N)	enumr   compressed_tensors.utilsr   torch.nnr   __all__r   r   r   r   r   <module>r1      s          = = = = = =       "#5
6    t   
!6 !6 !6 !6 !6 !6 !6 !6 !6 !6r   