+
    ÒÜ³j«  ã                   óØ   € ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ]! R4      w  t
t] P                  ! RRR7      t ! R R	]P                  4      t ! R
 R4      tRR R lltR tR# )é    N)ÚDict)Ú
try_import)Úunpack_reorder_packÚ	exlv2_extÚmeta)Údevicec                   ót   a a€ ] tR t^t oV 3R ltV3R lR lt]R
R l4       tR tR t	RR lt
R tR	tVtV ;t# )ÚWQLinear_ExllamaV2c           	     ó  <€ \         SV `  4        VR9  d   \        R4      hRV n        Wn        W0n        W@n        VR	8w  d   TMTV n        V P                  R\        P                  ! W4^ V P                  ,          ,          3\        P                  VR7      4       V P                  R\        P                  ! W0P                  ,          V^ V P                  ,          ,          3\        P                  VR7      4       V P                  R\        P                  ! W0P                  ,          V3\        P                  VR7      4       V'       d:   V P                  R\        P                  ! V\        P                  VR7      4       R# RV n        R# )
é   z!Only 4-bit are supported for now.NÚqweight©Údtyper   ÚqzerosÚscalesÚbias)r   éÿÿÿÿ)ÚsuperÚ__init__ÚNotImplementedErrorÚq_handleÚw_bitÚin_featuresÚout_featuresÚ
group_sizeÚregister_bufferÚtorchÚzerosÚint32Úfloat16r   )Úselfr   r   r   r   r   ÚdevÚ	__class__s   &&&&&&&€Ú]/home/luca/screen-checking/.venv/lib/python3.14/site-packages/awq/modules/linear/exllamav2.pyr   ÚWQLinear_ExllamaV2.__init__   s=  ø€ Ü‰ÑÔà˜ÔÜ%Ð&IÓJÐJàˆŒàŒ
Ø&ÔØ(ÔØ(2°bÔ(8™*¸kˆŒð 	×ÑØÜ�KŠKØ¨r°T·Z±ZÕ/?Õ@ÐAÜ—k‘kØôô	
ð 	×ÑØÜ�KŠKØ§¡Õ/°À"ÈÏ
É
ÕBRÕ1SÐTÜ—k‘kØôô	
ð 	×ÑØÜ�KŠKØ§¡Õ/°Ð>Ü—m‘mØôô	
÷ Ø× Ñ ØÜ—’Ø!ÜŸ-™-Øôöð ˆDŽIó    c                ó   <€ V ^8„  d   QhRR/# )é   Úscratch_spaceÚScratchSpace© )ÚformatÚ__classdict__s   "€r$   Ú__annotate__ÚWQLinear_ExllamaV2.__annotate__D   s   ø€ ÷ 
ñ 
 ~ñ 
r&   c                ó   € V P                   P                  P                  R 8X  g   Q hV P                   P                  P                  f   Q h\	        V P                   V P
                  V P                  4      w  V n         V n        V P                  4       pVP                  V4      p\        P                  V P                   \        \        \        \        \        V P
                  V P                  \        V4
      V n        R# )ÚcudaN)r   r   ÚtypeÚindexr   r   r   Útemp_dq_sizeÚ	get_slicer   Úmake_q_matrixÚnone_tensorr   r   )r!   r)   r4   Útemp_dqs   &&  r$   Ú	post_initÚWQLinear_ExllamaV2.post_initD   s¾   € Ø�|‰|×"Ñ"×'Ñ'¨6Ô1Ð1Ð1Ø�|‰|×"Ñ"×(Ñ(Ò4Ð4Ð4ä$7Ø�L‰L˜$Ÿ+™+ t§z¡zó%
Ñ!ˆŒ�d”kð ×(Ñ(Ó*ˆØ×)Ñ)¨,Ó7ˆÜ!×/Ñ/Ø�L‰LÜÜÜÜÜØ�K‰KØ�K‰KÜØó
ˆŽr&   c                ó®   € V ! VVVP                   VP                  VP                  R JVP                  P                  4      pV'       d   V# \        R4      h)Nz1Only inference is supported for ExllamaV2 kernels)r   r   r   Úweightr   r   )ÚclsÚlinearr   r   Ú	init_onlyr   r   Ú
awq_linears   &&&&&&& r$   Úfrom_linearÚWQLinear_ExllamaV2.from_linear[   sV   € ñ ØØØ×ÑØ×ÑØ�K‰K˜tÐ#Ø�M‰M× Ñ ó
ˆ
÷ ØÐä!Ð"UÓVÐVr&   c                óX   € V P                   V P                  ,          ^,          ^€,           # )zF
Returns the size of the temporary buffer required for the dq kernel.
)r   r   )r!   s   &r$   r4   ÚWQLinear_ExllamaV2.temp_dq_sizel   s%   € ð ×Ñ $×"3Ñ"3Õ3°aÕ7¸#Õ=Ð=r&   c                óR   € V P                   V,          V,          ^,          ^€,           # )zG
Returns the size of the temporary buffer required for the fwd kernel.
)r   ©r!   Úmax_input_lenÚmax_batch_sizes   &&&r$   Útemp_fwd_sizeÚ WQLinear_ExllamaV2.temp_fwd_sizer   s$   € ð × Ñ  =Õ0°>ÕAÀAÕEÈÕKÐKr&   c                óN   € V P                  4       V P                  W4      ,           # )zF
Returns the size of the fixed scratch space required for the kernel.
)r4   rI   rF   s   &&&r$   Úscratch_space_fixedÚ&WQLinear_ExllamaV2.scratch_space_fixedx   s#   € ð × Ñ Ó" T×%7Ñ%7¸Ó%VÕVÐVr&   c                ó  € V P                   f   Q R4       h\        f   \        R\        ,           4      hVP                  pVP
                  R R V P                  3,           pV\        P                  8w  d!   VP                  \        P                  R7      pVP                  RVP
                  R,          4      p\        P                  ! VP
                  ^ ,          V P                  3\        P                  VP                  R7      p\        P                  WP                   VR4       V\        P                  8w  d   VP                  VR7      pV P                  e   VP                  V P                  4       VP                  V4      # )Nzhmodule.post_init() must be called before module.forward(). Use exllamav2_post_init() on the whole model.z6External ExLlamaV2 kernels are not properly installed.)r   r   Fr   )r   r   ÚModuleNotFoundErrorÚmsgr   Úshaper   r   r    ÚtoÚviewÚemptyr   Úgemm_half_q_halfr   Úadd_)r!   ÚxÚinput_dtypeÚ	out_shapeÚouts   &&   r$   ÚforwardÚWQLinear_ExllamaV2.forward~   s%  € Ø�}‰}Ò(ð 	
ð<ó	
Ð(ô ÒÜ%Ð&^ÔadÕ&dÓeÐeà—g‘gˆØ—G‘G˜C˜R�L D×$5Ñ$5Ð#7Õ7ˆ	àœ%Ÿ-™-Ô'Ø—‘œ5Ÿ=™=�Ó)ˆAà�F‰F�2�q—w‘w˜r•{Ó#ˆä�kŠkØ�W‰W�Q�Z˜×*Ñ*Ð+Ü—-‘-Ø—8‘8ô
ˆô
 	×"Ñ" 1§m¡m°S¸%Ô@àœ%Ÿ-™-Ô'Ø—&‘&˜{�&Ó+ˆCà�9‰9Ò Ø�H‰H�T—Y‘YÔà�x‰x˜	Ó"Ð"r&   )r   r   r   r   r   r   r   r   )FNN©i   é   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r9   ÚclassmethodrA   r4   rI   rL   r[   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r#   r-   s   @@r$   r
   r
      sF   ù‡ € õ3÷j
ð 
ð. óWó ðWò >òLôW÷#ò #r&   r
   c                   ó,   a € ] tR t^žt o R tR tRtV tR# )r*   c                óŒ   € Wn         \        P                  ! V P                   ^,          \        P                  VR7      V n        R# )r(   r   N)Úscratch_bytesr   rT   r    Úscratch)r!   ri   r"   s   &&&r$   r   ÚScratchSpace.__init__Ÿ   s0   € Ø*ÔÜ—{’{Ø×Ñ !Õ#Ü—-‘-Øô
ˆŽr&   c                óf   € \        V^€4      ^,          pV P                  P                  ^ ^ V4      pV# )é€   )Únext_multiplerj   Únarrow)r!   Ú
size_bytesÚ
size_halfsÚscratch_slices   &&  r$   r5   ÚScratchSpace.get_slice§   s1   € Ü" :¨sÓ3°qÕ8ˆ
ØŸ™×+Ñ+¨A¨q°*Ó=ˆàÐr&   )rj   ri   N)r_   r`   ra   rb   r   r5   rd   re   )r-   s   @r$   r*   r*   ž   s   ø‡ € ò
÷ð r&   r*   c                ó0   € V ^8„  d   QhR\         R\         /# )r(   rG   rH   )Úint)r,   s   "r$   r.   r.   ®   s   € ÷ ñ ¬cð Ì#ñ r&   c                 ó<  € / pV P                  4        Fc  w  rE\        V\        4      '       g   K  VP                  P                  pVP                  WR 7      p\        VP                  V^ 4      V4      W6&   Ke  	  / V n        VP                  4        F  w  rh\        W†4      V P                  V&   K  	  V P                  4        FV  w  rE\        V\        4      '       g   K  VP                  P                  pVP                  V P                  V,          R7       KX  	  V # ))rG   rH   )r)   )Únamed_modulesÚ
isinstancer
   r   r   rL   ÚmaxÚgetÚscratch_spacesÚitemsr*   r9   )	ÚmodelrG   rH   Úfixed_bytesÚ_Ú	submoduler   Úscratch_fixedri   s	   &&&      r$   Úexllamav2_post_initr‚   ®   sþ   € à+-€KØ×+Ñ+Ö-‰ˆÜ�iÔ!3×4Ô4Ø×&Ñ&×-Ñ-ˆFØ%×9Ñ9Ø+ð :ó ˆMô #& k§o¡o°f¸aÓ&@À-Ó"PˆKÓñ .ð >@€EÔØ!,×!2Ñ!2Ö!4ÑˆÜ'3°MÓ'Jˆ×Ñ˜VÓ$ñ "5ð ×+Ñ+Ö-‰ˆÜ�iÔ!3×4Ô4Ø×&Ñ&×-Ñ-ˆFØ×Ñ¨e×.BÑ.BÀ6Õ.JÐÖKñ .ð
 €Lr&   c                 ó<   € W,           ^,
          V,          V,          # )é   r+   )rW   Úmultiples   &&r$   rn   rn   Æ   s   € Ø�\˜AÕ (Õ*¨hÕ6Ð6r&   )r„   r„   r]   )r   ÚwarningsÚtorch.nnÚnnÚtypingr   Úawq.utils.moduler   Úawq.utils.packing_utilsr   r   rP   rT   r7   ÚModuler
   r*   r‚   rn   r+   r&   r$   Ú<module>r�      s^   ðÛ Û Ý Ý Ý 'Ý 7á˜KÓ(�€	ˆ3ð �kŠk˜&¨Ô0€ôM#˜Ÿ™ô M#÷`ñ ÷ ô07r&   