Ë µL i¼ãó<—dZddlmZddlmZddlmZ dd„Zy)z9VPTQ (Vector Post-Training Quantization) integration fileéN)Úinit_empty_weights)Ú VQuantLinearcóF—|r|ndg}|j«D]w\}}|€g}|j|«dj|«}|j}|j} t |t j«rÐ||vrÌ|| vs|d|vrÁ| j|d«xs|j|dd«} t«5|j} |j} t| | | d| d| d| d| d | d | d | d | d dd|jdu¬«|j|<d}|j|jd«ddd«t!t#|j%«««dkDrt'|||||¬«\} }|j)d«Œz||fS#1swYŒYxYw)aw Public method that recursively replaces the Linear layers of the given model with VPTQ quantized layers. `accelerate` is needed to use this method. Returns the converted model and a boolean that indicates if the conversion has been successful or not. Args: model (`torch.nn.Module`): The model to convert, can be any `torch.nn.Module` instance. quantization_config (`VptqConfig`): The quantization config object that contains the quantization parameters. modules_to_not_convert (`list[`str`]`, *optional*, defaults to `["lm_head"]`): Names of the modules to not convert in `VQuantLinear`. In practice we keep the `lm_head` in full precision for numerical stability reasons. current_key_name (`list`, *optional*): A list that contains the current key name. This is used for recursion and should not be passed by the user. has_been_replaced (`bool`, *optional*): A boolean that indicates if the conversion has been successful or not. This is used for recursion and should not be passed by the user. Úlm_headNú.éÿÿÿÿÚ vector_lensÚ num_centroidsÚnum_res_centroidsÚ group_numÚ group_sizeÚ outlier_sizeÚindices_as_floatÚ enable_normÚ enable_permTF) r r r r r rrrrÚis_indice_packedÚenable_proxy_errorÚbiasr)Úquantization_configÚmodules_to_not_convertÚcurrent_key_nameÚhas_been_replaced)Únamed_childrenÚappendÚjoinÚshared_layer_configÚconfig_for_layersÚ isinstanceÚnnÚLinearÚgetrÚ in_featuresÚ out_featuresrrÚ_modulesÚrequires_grad_ÚlenÚlistÚchildrenÚreplace_with_vptq_linearÚpop)ÚmodelrrrrÚnameÚmoduleÚ layer_namerrÚ layer_paramsr"r#Ú_s úd/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/transformers/integrations/vptq.pyr)r)sõ€ñ68NÑ3ÐT]ÐS^Ðà×,Ñ,Ó.ó2!‰ ˆˆfØ Ð #Ø!Ð Ø×Ñ Ô%Ø—X‘XÐ.Ó/ˆ Ø1×EÑEÐØ/×AÑAÐô vœrŸy™yÔ )ØÐ"8Ñ8ØÐ 1Ñ1Ð7GÈÑ7KÐObÑ7bà,×0Ñ0°¸TÓBòÐFY×F]ÑF]Ø  Ñ$ dóGˆLô$Ó%ñ ;Ø$×0Ñ0 Ø%×2Ñ2 ä'3ØØ Ø ,¨]Ñ ;Ø".¨Ñ"?Ø&2Ð3FÑ&GØ*¨;Ñ7Ø+¨LÑ9Ø!-¨nÑ!=Ø%1Ð2DÑ%EØ ,¨]Ñ ;Ø ,¨]Ñ ;Ø%)Ø',ØŸ™¨DÐ0ô(—‘˜tÑ$ð %)Ð!𗑘tÑ$×3Ñ3°EÔ:÷/ ;ô0 ŒtF—O‘OÓ%Ó&Ó '¨!Ò +Ü#;ØØ$7Ø'=Ø!1Ø"3ô $Ñ ˆAÐ ð ×јRÖ ðe2!ðf Ð#Ð #Ð#÷E ;ð ;ús Â9BFÆF )NNNF)Ú__doc__Útorch.nnrÚ acceleraterÚvptqrr)©ór1úr8s'ðñ<åÝ)Ýð ØØØô P$r7