§
    Ý˜ºhcP  ã            
       ó¢  — d 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	m
Z
mZmZ ddlmZmZmZmZ  e¦   «         r
ddlZddlmZ  ej        e¦  «        Zg d	¢g d
¢g d¢ddœg d	¢g d¢g d¢dddœg d	¢g d
¢g d¢ddœg d	¢g d
¢g d¢ddœdœZdddœdddœdddœdddœdddœdddœdddœdddœdœZd„ Z	 	 	 	 d$defd„Zd„ Zd„ Zd„ Zd „ Z d!„ Z!d"„ Z"d#„ Z#dS )%z;AWQ (Activation aware Weight Quantization) integration fileé    N)Úversioné   )ÚACT2FN)ÚPreTrainedModel)Úis_auto_awq_availableÚis_ipex_availableÚis_torch_availableÚlogging)ÚAwqBackendPackingMethodÚ	AwqConfigÚAWQLinearVersionÚExllamaVersion)Úq_projÚk_projÚv_projÚo_proj)Ú	gate_projÚup_projÚ	down_proj)Úinput_layernormÚpost_attention_layernormÚnormF)Ú	attentionÚmlpÚ	layernormÚ	use_alibi)Úw1Úw3Úw2g    €„.A)r   r   r   r   Ú
rope_theta)ÚmistralÚmixtralÚllamaÚllavaÚactÚc_fc)r%   Úlayer_before_actÚdense_h_to_4hr   Úfc_inÚ	gelu_impl)Ú
starcoder2ÚRefinedWebModelÚfalconÚmptÚgptjÚgpt_neoxÚgpt_bigcodeÚbloomc                 ó”  — ddl m} |t          vr| S |                      ¦   «         D ]¡\  }}t          |         d         }t          |         d         }||k    r`t	          | |¦  «        rPt          | t          |         d         ¦  «        }|j        }t          j        |¦  «        }	 |||	¦  «        | j	        |<   t          ||¦  «        }
Œ¢| S )Nr   )ÚScaledActivationr%   r'   )Úawq.modules.actr4   ÚAWQ_SCALES_MAPPINGSÚnamed_childrenÚhasattrÚgetattrÚout_featuresÚtorchÚonesÚ_modulesÚreplace_quantization_scales)ÚmodelÚ
model_typer4   ÚnameÚmoduleÚact_nameÚlayer_before_act_namer'   ÚsizeÚ
scale_likeÚ_s              úe/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/transformers/integrations/awq.pyr>   r>   M   sá   € Ø0Ð0Ð0Ð0Ð0Ð0àÕ,Ð,Ð,ØˆØ×,Ò,Ñ.Ô.ð <ð <‰ˆˆfÝ& zÔ2°5Ô9ˆÝ 3°JÔ ?Ð@RÔ SÐØ�8ÒÐ¥¨Ð/DÑ EÔ EÐÝ& uÕ.AÀ*Ô.MÐN`Ô.aÑbÔbÐØ#Ô0ˆDÝœ DÑ)Ô)ˆJØ#3Ð#3°F¸JÑ#GÔ#GˆEŒN˜4Ñ Ý'¨°
Ñ;Ô;ˆˆØ€Ló    Úreturnc           	      óÂ  ‡— |€g }|j         }t          ¦   «         st          d¦  «        ‚|t          j        k    rë|j        t          j        k    r	ddlm	} |}nÕ|j        t          j
        k    r	ddlm} |}n·|j        t          j        k    re|j        d         t          j        k    r	ddlm}	 |	}n~|j        d         t          j        k    r	ddlm}
 |
}nZt          d	|j        d         › �¦  «        ‚|j        t          j        k    r	dd
lm} |}nt          d|j        › �¦  «        ‚ddlm} |}|                      ¦   «         D �]\  }}‰€g Š‰                     |¦  «         t;          |t<          j        ¦  «        rƒ||vrtA          ˆfd„|D ¦   «         ¦  «        sd|j!        }|j"        } ||j#        |j$        |||j%        du|j&        j'        ¬¦  «        | j(        |<   d}| j(        |          )                    d¦  «         tU          tW          | ,                    ¦   «         ¦  «        ¦  «        dk    rt[          ||‰||¬¦  «        \  }}‰ .                    d¦  «         �Œ| |fS )a¤  
    Public method that recursively replaces the Linear layers of the given model with AWQ 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.

    During the module replacement, we also infer the backend to use through the `quantization_config` object.

    Args:
        model (`torch.nn.Module`):
            The model to convert, can be any `torch.nn.Module` instance.
        quantization_config (`AwqConfig`):
            The quantization config object that contains the quantization parameters.
        modules_to_not_convert (`list`, *optional*):
            A list of modules to not convert. If a module name is in the list (e.g. `lm_head`), it will not be
            converted.
        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.
    Nz¯AWQ (either `autoawq` or `llmawq`) is not available. Please install it with `pip install autoawq` or check out the installation guide in https://github.com/mit-han-lab/llm-awqr   )ÚWQLinear_GEMM)ÚWQLinear_GEMVr   )ÚWQLinear_Exllama)ÚWQLinear_ExllamaV2úUnrecognized Exllama version: ©ÚWQLinear_IPEXzUnrecognized AWQ version: )ÚWQLinearc              3   óF   •K  — | ]}|d                       ‰¦  «        v V — ŒdS )ú.N)Újoin)Ú.0ÚkeyÚcurrent_key_names     €rH   ú	<genexpr>z*replace_with_awq_linear.<locals>.<genexpr>ª   s5   øè è € Ð[Ð[¸S�s˜cŸhšhÐ'7Ñ8Ô8Ð8Ð[Ð[Ð[Ð[Ð[Ð[rI   )Úw_bitÚ
group_sizeÚin_featuresr:   ÚbiasÚdevTF)Úmodules_to_not_convertrY   Úquantization_configÚhas_been_replacedéÿÿÿÿ)/Úbackendr   Ú
ValueErrorr   ÚAUTOAWQr   r   ÚGEMMÚawq.modules.linear.gemmrL   ÚGEMVÚawq.modules.linear.gemvrM   ÚEXLLAMAÚexllama_configr   ÚONEÚawq.modules.linear.exllamarN   ÚTWOÚawq.modules.linear.exllamav2rO   ÚIPEXÚawq.modules.linear.gemm_ipexrR   Úawq.quantize.qmodulerS   r7   ÚappendÚ
isinstanceÚnnÚLinearÚanyr]   r:   Úbitsr\   r^   ÚweightÚdevicer=   Úrequires_grad_ÚlenÚlistÚchildrenÚreplace_with_awq_linearÚpop)r?   r`   ra   rY   rb   rd   rL   Ú
target_clsrM   rN   rO   rR   rS   rA   rB   r]   r:   rG   s      `              rH   r€   r€   ^   s  ø€ ð8 Ð%Ø!#Ðà!Ô)€Gå Ñ"Ô"ð 
Ýð ~ñ
ô 
ð 	
ð Õ)Ô1Ò1Ð1ØÔ&Õ*:Ô*?Ò?Ð?Ø=Ð=Ð=Ð=Ð=Ð=à&ˆJˆJØ Ô(Õ,<Ô,AÒAÐAØ=Ð=Ð=Ð=Ð=Ð=à&ˆJˆJØ Ô(Õ,<Ô,DÒDÐDØ"Ô1°)Ô<ÅÔ@RÒRÐRØGÐGÐGÐGÐGÐGà-�
�
Ø$Ô3°IÔ>Å.ÔBTÒTÐTØKÐKÐKÐKÐKÐKà/�
�
å Ð!qÐBUÔBdÐenÔBoÐ!qÐ!qÑrÔrÐrØ Ô(Õ,<Ô,AÒAÐAØBÐBÐBÐBÐBÐBà&ˆJˆJåÐWÐ:MÔ:UÐWÐWÑXÔXÐXà1Ð1Ð1Ð1Ð1Ð1àˆ
à×,Ò,Ñ.Ô.ð  !ñ  !‰ˆˆfØÐ#Ø!ÐØ×Ò Ñ%Ô%Ð%å�f�bœiÑ(Ô(ð 	;¨TÐ9OÐ-OÐ-OåÐ[Ð[Ð[Ð[ÐDZÐ[Ñ[Ô[Ñ[Ô[ð ;Ø$Ô0�Ø%Ô2�à'1 zØ-Ô2Ø2Ô=Ø +Ø!-Øœ¨DÐ0ØœÔ,ð(ñ (ô (�”˜tÑ$ð %)Ð!ð ”˜tÔ$×3Ò3°EÑ:Ô:Ð:Ý�t�F—O’OÑ%Ô%Ñ&Ô&Ñ'Ô'¨!Ò+Ð+Ý#:ØØ'=Ø!1Ø$7Ø"3ð$ñ $ô $Ñ ˆAÐ ð 	×Ò˜RÑ Ô Ð Ñ ØÐ#Ð#Ð#rI   c                 ó´  — t          | t          ¦  «        st          d| j        j        › �¦  «        ‚|j        �|j        }|j        |d<   n�| j        j        t          v rkt          | j        j                 }| j         
                    d¬¦  «        }|j        }|j        }t          |d|¦  «        }||d<   ||d<   ||d<   |j        |d<   nt          d	¦  «        ‚|S )
af  
    Returns the fusing mapping given the quantization config and the model

    Args:
        model (`~PreTrainedModel`):
            The model to fuse - note this model should have been converted into AWQ format beforehand.
        quantization_config (`~transformers.quantization_config.AWQConfig`):
            The quantization configuration to use.
    z:The model should be an instance of `PreTrainedModel`, got NÚmax_seq_lenT©ÚdecoderÚnum_key_value_headsÚhidden_sizeÚnum_attention_headsa  Fusing mapping not found either on the quantization config or the supported `AWQ_FUSED_MAPPINGS`. Please pass a `fused_mapping` argument in the `quantization_config` or raise an issue on transformers https://github.com/huggingface/transformers to add its support.)ru   r   Ú	TypeErrorÚ	__class__Ú__name__Úmodules_to_fuseÚfuse_max_seq_lenÚconfigr@   ÚAWQ_FUSED_MAPPINGSÚget_text_configrˆ   r‰   r9   re   )r?   ra   Úcurrent_fused_mappingr�   rˆ   r‰   r‡   s          rH   Úget_modules_to_fuser“   Ç   s  € õ �e�_Ñ-Ô-ð qÝÐoÐUZÔUdÔUmÐoÐoÑpÔpÐpð Ô*Ð6Ø 3Ô CÐØ/BÔ/SÐ˜mÑ,Ð,Ø	ŒÔ	 Õ$6Ð	6Ð	6Ý 2°5´<Ô3JÔ KÐð ”×-Ò-°dÐ-Ñ;Ô;ˆð Ô(ˆØ$Ô8ÐÝ% fÐ.CÐEXÑYÔYÐð 0;Ð˜mÑ,Ø7JÐÐ3Ñ4Ø7JÐÐ3Ñ4Ø/BÔ/SÐ˜mÑ,Ð,åðNñ
ô 
ð 	
ð !Ð rI   c                 ó¬  ‡
‡‡— t          |t          ¦  «        rt          j        |¦  «        }|j        }t          | |¦  «        }t          |dd¦  «        }|t          j        k    rddl	m
} ddlm} ddlm} nt          d¦  «        ‚g Š
|                      ¦   «         D ]¼\  Š}|�t#          ˆfd„|D ¦   «         ¦  «        rŒ#t%          |d	         ||¦  «         |j        d
k    rt)          | ‰|d         ||¦  «         nt*                               d¦  «         t/          | ||‰|¦  «        }	|	r.‰
                     ‰                     d¦  «        d         ¦  «         Œ½t5          ‰
¦  «        dk    rg|                      ¦   «         D ]R\  Š}t#          ˆ
ˆfd„‰
D ¦   «         ¦  «        r1t7          |d¦  «        r!t7          |j        d¦  «        rd|j        _        ŒS| S )aJ  
    Optionally fuse some modules in the model to speedup inference.

    Args:
        model (`~PreTrainedModel`):
            The model to fuse - note this model should have been converted into AWQ format beforehand.
        quantization_config (`Union[AwqConfig, dict]`):
            The quantization configuration to use.
    r`   Nr   )ÚQuantAttentionFused)ÚQuantFusedMLP)ÚFasterTransformerRMSNormz0Fusing is only supported for the AutoAWQ backendc              3   ó    •K  — | ]}|‰v V — Œ	d S ©N© )rW   Úmodule_name_to_not_convertrA   s     €rH   rZ   z#fuse_awq_modules.<locals>.<genexpr>  s*   øè è € ÐoÐoÐ:TÐ-°Ð5ÐoÐoÐoÐoÐoÐorI   r   Úipexr   z7The IPEX version AWQ does not support fuse mlp for now.rU   c              3   ó    •K  — | ]}‰‰v V — Œ	d S r™   rš   )rW   Úfused_attention_parent_moduleÚfused_attention_modulesÚmodule_names     €€rH   rZ   z#fuse_awq_modules.<locals>.<genexpr>(  s:   øè è € ð ð Ø;X�Ð6Ð6ðð ð ð ð ð rI   r�   Ú_attn_implementationÚcustom)ru   Údictr   Ú	from_dictrd   r“   r9   r   rf   Úawq.modules.fused.attnr•   Úawq.modules.fused.mlpr–   Úawq.modules.fused.normr—   re   Únamed_modulesrx   Ú_fuse_awq_layernormr   Ú_fuse_awq_mlpÚloggerÚinfoÚ_fuse_awq_attention_layersrt   Úsplitr}   r8   r�   r¡   )r?   ra   rd   r�   r`   r•   r–   r—   rB   Úattention_has_been_fusedrŸ   r    rA   s             @@@rH   Úfuse_awq_modulesr°   ð   s\  øøø€ õ Ð%¥tÑ,Ô,ð GÝ'Ô1Ð2EÑFÔFÐØ!Ô)€Gå)¨%Ð1DÑEÔE€OÝ$Ð%8Ð:RÐTXÑYÔYÐàÕ)Ô1Ò1Ð1Ø>Ð>Ð>Ð>Ð>Ð>Ø7Ð7Ð7Ð7Ð7Ð7ØCÐCÐCÐCÐCÐCÐCåÐKÑLÔLÐLà Ðà×+Ò+Ñ-Ô-ð ?ð ?‰ˆˆfØ!Ð-ÝÐoÐoÐoÐoÐXnÐoÑoÔoÑoÔoð Øõ 	˜O¨KÔ8¸&ÐBZÑ[Ô[Ð[ð Ô&¨&Ò0Ð0Ý˜%  °uÔ'=¸vÀ}ÑUÔUÐUÐUå�KŠKÐQÑRÔRÐRõ $>Ø�6˜?¨DÐ2Eñ$
ô $
Ð ð $ð 	?Ø#×*Ò*¨4¯:ª:°c©?¬?¸1Ô+=Ñ>Ô>Ð>øõ
 Ð"Ñ#Ô# aÒ'Ð'Ø#(×#6Ò#6Ñ#8Ô#8ð 	Bð 	BÑˆK˜Ýð ð ð ð ð Ø\sðñ ô ñ ô ð Bõ ˜6 8Ñ,Ô,ð Bµ¸¼ÐH^Ñ1_Ô1_ð BØ9A�F”MÔ6øØ€LrI   c                 óÈ   — | D ]^}t          ||¦  «        rLt          ||¦  «        } ||j        |j        ¦  «                             |j        j        ¦  «        |j        |<   ~Œ_dS )a¬  
    Fuse the LayerNorm layers into a target class using autoawq

    Args:
        fuse_module_names (`list[str]`):
            The list of module names to fuse
        module (`nn.Module`):
            The pytorch parent module that has layernorm modules to fuse
        target_cls (`~autoawq.FasterTransformerRMSNorm`):
            The `FasterTransformerRMSNorm` class as it only supports that class
            for now.
    N)r8   r9   rz   Úvariance_epsilonÚtor{   r=   )Úfuse_module_namesrB   r‚   r    Ú
old_modules        rH   r©   r©   0  s€   € ð )ð ð ˆÝ�6˜;Ñ'Ô'ð 	Ý  ¨Ñ5Ô5ˆJØ+5¨:ØÔ!ØÔ+ñ,ô ,÷ Šb�Ô"Ô)Ñ*Ô*ð ŒO˜KÑ(ð øðð rI   c                 ó   — t          |¦  «        dk    rdS t          ||d         ¦  «        rât          ||d         ¦  «        }t          ||d         ¦  «        }t          ||d         ¦  «        }|j        j        }| j                             d¬¦  «        }	|	j        }
t          |
         } |||||¦  «        }| 	                    dd¦  «        \  }}|  
                    |¦  «        }t          |||                     |¦  «        ¦  «         ~~~dS dS )aÏ  
    Fuse the MLP layers into a target class using autoawq

    Args:
        model (`~PreTrainedModel`):
            The input pretrained model
        current_module_name (`str`):
            The current submodule name
        fuse_module_names (`list[str]`):
            The list of module names to fuse. For the MLP layers it has to be an array
            of length 3 that consists of the 3 MLP layers in the order (gate (dense layer post-attention) / up / down layers)
        module (`nn.Module`):
            The pytorch parent module that has layernorm modules to fuse
        target_cls (`~autoawq.QuantFusedMLP`):
            The `QuantFusedMLP` class as it only supports that class
            for now.
    r   Né   r   Tr…   rU   )r}   r8   r9   Úqweightr{   r�   r‘   Ú
hidden_actr   ÚrsplitÚget_submoduleÚsetattrr³   )r?   Úcurrent_module_namer´   rB   r‚   r   r   r   Úprevious_devicer�   r¹   Úactivation_fnÚ
new_moduleÚparent_nameÚ
child_nameÚparents                   rH   rª   rª   G  s   € õ$ ÐÑÔ Ò"Ð"ØˆåˆvÐ(¨Ô+Ñ,Ô,ð *Ý˜FÐ$5°aÔ$8Ñ9Ô9ˆ	Ý˜&Ð"3°AÔ"6Ñ7Ô7ˆÝ˜FÐ$5°aÔ$8Ñ9Ô9ˆ	à#Ô+Ô2ˆð ”×-Ò-°dÐ-Ñ;Ô;ˆØÔ&ˆ
Ý˜zÔ*ˆØ�Z 	¨9°g¸}ÑMÔMˆ
à"5×"<Ò"<¸SÀ!Ñ"DÔ"DÑˆ�ZØ×$Ò$ [Ñ1Ô1ˆÝ�˜
 J§M¢M°/Ñ$BÔ$BÑCÔCÐCà�w 	 	 	ð#*ð *rI   c                 óÐ  — ddl m}m} d}t          |d         ¦  «        dk    r|S t	          ||d         d         ¦  «        �r#t          ||d         d         ¦  «        }t          ||¦  «        r|}	d}
n”t          ||¦  «        r|}	d}
nt          ¦   «         rbt          j	        t          j                             d¦  «        ¦  «        t          j	        d¦  «        k    rddl m} t          ||¦  «        r|}	d}
nt          d	¦  «        ‚|j        j        }t          ||d         d         ¦  «        }t          ||d         d
         ¦  «        }t          ||d         d         ¦  «        }|j        �(t#          j        |j        |j        |j        gd¬¦  «        nd} |	|j        |j        |j        |j        |j        z   |j        z   |j        dut/          t1          |                     ¦   «                              ¦   «         ¦  «        ¦  «        j        ¦  «        }t#          j        |j        |j        |j        g|
¬¦  «        |_        t#          j        |j        |j        |j        g|
¬¦  «        |_        t#          j        |j        |j        |j        g|
¬¦  «        |_        t          ||¦  «        r|j        |_        ||_         ||d         |d         |d         ||||d         |d         |                     dd¦  «        ¬¦	  «	        }d|_        |                      dd¦  «        \  }}|  !                    |¦  «        }tE          ||| #                    |¦  «        ¦  «         ~~~~d}|S )a²  
    Fuse the Attention layers into a target class using autoawq

    Args:
        model (`~PreTrainedModel`):
            The input pretrained model
        module (`nn.Module`):
            The pytorch parent module that has layernorm modules to fuse
        modules_to_fuse (`list[str]`):
            The module fusing mapping. The dictionary has to contain a field `attention` with attention module names
            in the correct order: q, k, v, o layer
        current_module_name (`str`):
            The current submodule name
        target_cls (`~autoawq.QuantAttentionFused`):
            The `QuantAttentionFused` class as it only supports that class
            for now.
    r   )rL   rM   Fr   r·   Úautoawqz0.2.6rQ   z'Unsupported q_proj type: {type(q_proj)}r   é   N)Údimrˆ   r‰   r‡   r„   r   r    g     ˆÃ@)r   r    TrU   )$Úawq.modules.linearrL   rM   r}   r8   r9   ru   r   r   ÚparseÚ	importlibÚmetadatarR   re   r¸   r{   r^   r;   Úcatr[   r\   r]   r:   ÚnextÚiterÚ
state_dictÚvaluesÚqzerosÚscalesÚsplit_k_itersÚgetÚis_hf_transformersrº   r»   r¼   r³   )r?   rB   r�   r½   r‚   rL   rM   Úmodule_has_been_fusedr   Úlinear_target_clsÚcat_dimrR   r¾   r   r   r   r^   Ú	qkv_layerÚfused_attention_layerrÁ   rÂ   rÃ   s                         rH   r­   r­   p  s‹  € ð$ @Ð?Ð?Ð?Ð?Ð?Ð?Ð?à!Ðå
ˆ?˜;Ô'Ñ(Ô(¨AÒ-Ð-Ø$Ð$åˆv� {Ô3°AÔ6Ñ7Ô7ñ A%å˜ °Ô!=¸aÔ!@ÑAÔAˆå�f˜mÑ,Ô,ð 	HØ -ÐØˆGˆGÝ˜ Ñ.Ô.ð 
	HØ -ÐØˆGˆGÝÑ Ô ð 	H¥W¤]µ9Ô3E×3MÒ3MÈiÑ3XÔ3XÑ%YÔ%YÕ\cÔ\iÐjqÑ\rÔ\rÒ%rÐ%rØ8Ð8Ð8Ð8Ð8Ð8å˜& -Ñ0Ô0ð Ø$1Ð!Ø�øåÐFÑGÔGÐGà œ.Ô/ˆå˜ °Ô!=¸aÔ!@ÑAÔAˆÝ˜ °Ô!=¸aÔ!@ÑAÔAˆÝ˜ °Ô!=¸aÔ!@ÑAÔAˆàLRÌKÐLc�uŒy˜&œ+ v¤{°F´KÐ@ÀaÐHÑHÔHÐHÐimˆà%Ð%ØŒLØÔØÔØÔ &Ô"5Ñ5¸Ô8KÑKØŒK˜tÐ#Ý•�f×'Ò'Ñ)Ô)×0Ò0Ñ2Ô2Ñ3Ô3Ñ4Ô4Ô;ñ
ô 
ˆ	õ "œI v¤~°v´~ÀvÄ~Ð&VÐ\cÐdÑdÔdˆ	ÔÝ œ9 f¤m°V´]ÀFÄMÐ%RÐX_Ð`Ñ`Ô`ˆ	ÔÝ œ9 f¤m°V´]ÀFÄMÐ%RÐX_Ð`Ñ`Ô`ˆ	Ôå�i Ñ/Ô/ð 	;Ø&,Ô&:ˆIÔ#àˆ	Œà * 
Ø˜MÔ*ØÐ1Ô2ØÐ1Ô2ØØØØ˜MÔ*Ø% kÔ2à&×*Ò*¨<¸ÑAÔAð!
ñ !
ô !
Ðð 48ÐÔ0à"5×"<Ò"<¸SÀ!Ñ"DÔ"DÑˆ�ZØ×$Ò$ [Ñ1Ô1ˆÝ�˜
Ð$9×$<Ò$<¸_Ñ$MÔ$MÑNÔNÐNà�F˜F FØ $Ðà Ð rI   c                 óô   — |d         t           j        k    rddlm}  || ¦  «        } nO|d         t           j        k    r!ddlm}  || |d         |d         ¬¦  «        } nt          d|d         › �¦  «        ‚| S )	zœ
    Runs post init for Exllama layers which performs:
        - Weights unpacking, reordering and repacking
        - Devices scratch space allocation
    r   r   )Úexllama_post_init)Úexllamav2_post_initÚmax_input_lenÚmax_batch_size)rÞ   rß   rP   )r   rm   rn   rÜ   ro   rp   rÝ   re   )r?   rl   rÜ   rÝ   s       rH   Úpost_init_awq_exllama_modulesrà   Ï  s°   € ð �iÔ ¥NÔ$6Ò6Ð6Ø@Ð@Ð@Ð@Ð@Ð@à!Ð! %Ñ(Ô(ˆˆØ	˜	Ô	"¥nÔ&8Ò	8Ð	8ØDÐDÐDÐDÐDÐDà#Ð#ØØ(¨Ô9Ø)Ð*:Ô;ð
ñ 
ô 
ˆˆõ ÐU¸.ÈÔ:SÐUÐUÑVÔVÐVà€LrI   c                 ó(   — ddl m}  || ¦  «        } | S )zl
    Runs post init for IPEX layers which performs:
        - Weights packing, reordering and repacking
    r   )Úipex_post_init)rr   râ   )r?   râ   s     rH   Úpost_init_awq_ipex_modulesrã   è  s*   € ð <Ð;Ð;Ð;Ð;Ð;àˆN˜5Ñ!Ô!€Eà€LrI   )NNNF)$Ú__doc__rÊ   Ú	packagingr   Úactivationsr   Úmodeling_utilsr   Úutilsr   r   r	   r
   Úutils.quantization_configr   r   r   r   r;   Útorch.nnrv   Ú
get_loggerrŒ   r«   r�   r6   r>   Úboolr€   r“   r°   r©   rª   r­   rà   rã   rš   rI   rH   ú<module>rí      sÏ  ðð >Ð =à Ð Ð Ð à Ð Ð Ð Ð Ð à  Ð  Ð  Ð  Ð  Ð  Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ Yðð ð ð ð ð ð ð ð ð ð ð ð ÐÑÔð Ø€L€L€LØÐÐÐÐÐà	ˆÔ	˜HÑ	%Ô	%€ð >Ð=Ð=Ø4Ð4Ð4ØLÐLÐLØð	ð ð >Ð=Ð=Ø!Ð!Ð!ØLÐLÐLØØðð ð >Ð=Ð=Ø4Ð4Ð4ØLÐLÐLØð	ð ð >Ð=Ð=Ø4Ð4Ð4ØLÐLÐLØð	ð ð)ð Ð ð:  °VÐ<Ð<Ø$¸/ÐJÐJØ°ÐAÐAØ¨iÐ8Ð8Ø¨wÐ7Ð7Ø°?ÐCÐCØ °fÐ=Ð=Ø °oÐFÐFð	ð 	Ð ðð ð ð&  ØØØðf$ð f$ð 
ðf$ð f$ð f$ð f$ðR&!ð &!ð &!ðR=ð =ð =ð@ð ð ð.&*ð &*ð &*ðR\!ð \!ð \!ð~ð ð ð2
ð 
ð 
ð 
ð 
rI   