+
    QV-j  ã                   ó´   € ^ RI Ht ^RIHt ]'       d   ^RIHt ^RIHt ^RIH	t	H
t
 ]
P                  ! ]4      tRRRR	R
RRRRRRRRRRR/t ! R R]4      tR# )é    )ÚTYPE_CHECKING)ÚHfQuantizer)ÚPreTrainedModel)ÚQuarkConfig)Úis_quark_availableÚloggingÚweight_scalezweight_quantizer.scaleÚ
bias_scalezbias_quantizer.scaleÚinput_scalezinput_quantizer.scaleÚoutput_scalezoutput_quantizer.scaleÚweight_zero_pointzweight_quantizer.zero_pointÚbias_zero_pointzbias_quantizer.zero_pointÚinput_zero_pointzinput_quantizer.zero_pointÚoutput_zero_pointzoutput_quantizer.zero_pointc                   óŒ   a a€ ] tR t^*t oRtRtV 3R ltR tV3R lR ltV3R lR lt	R	 t
]R
 4       tR tV3R ltRtVtV ;t# )ÚQuarkHfQuantizerz7
Quark quantizer (https://quark.docs.amd.com/latest/).
Tc                óL   <€ \         SV `  ! V3/ VB  VP                  V n        R # )N)ÚsuperÚ__init__Újson_export_config)ÚselfÚquantization_configÚkwargsÚ	__class__s   &&,€Úx/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/quantizers/quantizer_quark.pyr   ÚQuarkHfQuantizer.__init__2   s$   ø€ Ü‰ÒÐ,Ñ7°Ò7à"5×"HÑ"HˆÖó    c                ó<   € \        4       '       g   \        R 4      hR# )z¥Loading a Quark quantized model requires the `quark` library but it was not found in the environment. Please refer to https://quark.docs.amd.com/latest/install.html.N)r   ÚImportError)r   Úargsr   s   &*,r   Úvalidate_environmentÚ%QuarkHfQuantizer.validate_environment7   s#   € Ü!×#Ò#Üð xóð ñ $r   c                ó   <€ V ^8„  d   QhRR/# )é   Úmodelr   © )ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚQuarkHfQuantizer.__annotate__=   s   ø€ ÷ 
ñ 
Ð:Kñ 
r   c                ó¢   € ^ RI Hp V! VV P                  P                  V P                  P
                  V P                  P                  R7       V# )r   )Ú_map_to_quark)Úpack_methodÚcustom_mode)Úquark.torch.export.apir,   r   Úquant_configr   r-   r.   )r   r%   r   r,   s   &&, r   Ú$_process_model_before_weight_loadingÚ5QuarkHfQuantizer._process_model_before_weight_loading=   sD   € Ý8áØØ×$Ñ$×1Ñ1Ø×/Ñ/×;Ñ;Ø×0Ñ0×<Ñ<õ		
ð ˆr   c                ó*   <€ V ^8„  d   QhRRRS[ RS[/# )r$   r%   r   Ú
param_nameÚreturn)ÚstrÚbool)r'   r(   s   "€r   r)   r*   I   s$   ø€ ÷ ñ Ð.?ð ÉSð Ñ_cñ r   c                ó   € R # )Tr&   )r   r%   r4   r   s   &&&,r   Úparam_needs_quantizationÚ)QuarkHfQuantizer.param_needs_quantizationI   s   € Ùr   c                ó   € R # ©Fr&   ©r   s   &r   Úis_serializableÚ QuarkHfQuantizer.is_serializableL   s   € Ùr   c                ó   € R # r<   r&   r=   s   &r   Úis_trainableÚQuarkHfQuantizer.is_trainableO   s   € ár   c           
     ó    € ^RI Hp ^RIHp . p\        P                  4        F'  w  rEVP                  V! V.VV! V 4      .R7      4       K)  	  V# )r$   )ÚWeightConverter)ÚQuarkDeserialize)Úsource_patternsÚtarget_patternsÚ
operations)Úcore_model_loadingrD   Úintegrations.quarkrE   ÚCHECKPOINT_KEYSÚitemsÚappend)r   rD   rE   Ú
convertersÚ
source_keyÚ
target_keys   &     r   Úget_weight_conversionsÚ'QuarkHfQuantizer.get_weight_conversionsS   sV   € Ý8Ý9ð ˆ
Ü&5×&;Ñ&;Ö&=Ñ"ˆJØ×ÑÙØ%/ LØ$.Ù 0°Ó 6Ð7ôöñ '>ð Ðr   c                ó$   <€ V ^8„  d   Qh/ R;R&   # )r$   r   r   r&   )r'   r(   s   "€r   r)   r*   *   s   ø‡ ‚ ð 'Ñ&ò r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úrequires_calibrationr   r!   r1   r9   r>   ÚpropertyrA   rQ   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   r(   s   @@r   r   r   *   sW   ù‡ € ñð  ÐõIò
÷
ð 
÷ð òð ñó ðò÷S … r   r   N)Útypingr   Úbaser   Úmodeling_utilsr   Úutils.quantization_configr   Úutilsr   r   Ú
get_loggerrT   ÚloggerrK   r   r&   r   r   Ú<module>rf      sr   ðõ !å ÷ Ý0Ý7ç /ð 
×	Ò	˜HÓ	%€ð Ð,ØÐ(ØÐ*ØÐ,ØÐ6ØÐ2ØÐ4ØÐ6ð	€ô>�{ö >r   