+
    QV-jÝ
  ã                   óÒ   € ^ RI Ht ^RIHt ]'       d   ^RIHt ^RIHt ^RIH	t	 ^RI
HtHtHtHt ^RIHt ]! 4       '       d   ^ RIt]P"                  ! ]4      t ! R	 R
]4      tR# )é    )ÚTYPE_CHECKING)ÚHfQuantizer)ÚPreTrainedModel)Ú
SpQRConfig)Úreplace_with_spqr_linear)Úis_accelerate_availableÚis_spqr_availableÚis_torch_availableÚlogging©ÚQuantizationConfigMixinNc                   ó’   a a€ ] tR t^"t oRtRtV3R lV 3R lltR tV3R lR ltV3R lR	 lt	]
R
 4       tR tV3R ltRtVtV ;t# )ÚSpQRHfQuantizerzK
Quantizer of the SpQR method. Enables the loading of prequantized models.
Tc                ó    <€ V ^8„  d   QhRS[ /# )é   Úquantization_configr   )ÚformatÚ__classdict__s   "€Úw/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/quantizers/quantizer_spqr.pyÚ__annotate__ÚSpQRHfQuantizer.__annotate__*   s   ø€ ÷ 8ñ 8Ñ,Cñ 8ó    c                ó*   <€ \         SV `  ! V3/ VB  R # )N)ÚsuperÚ__init__)Úselfr   ÚkwargsÚ	__class__s   &&,€r   r   ÚSpQRHfQuantizer.__init__*   s   ø€ Ü‰ÒÐ,Ñ7°Ô7r   c                óÐ   € \         P                  P                  4       '       g   \        R 4      h\	        4       '       g   \        R4      h\        4       '       g   \        R4      hR# )z,GPU is required to run SpQR quantized model.zGUsing `spqr` quantization requires Accelerate: `pip install accelerate`zFUsing `spqr` quantization requires SpQR: `pip install spqr_quant[gpu]`N)ÚtorchÚcudaÚis_availableÚRuntimeErrorr   ÚImportErrorr	   )r   Úargsr   s   &*,r   Úvalidate_environmentÚ$SpQRHfQuantizer.validate_environment-   sP   € Ü�z‰z×&Ñ&×(Ò(ÜÐMÓNÐNä&×(Ò(ÜÐgÓhÐhä ×"Ò"ÜÐfÓgÐgñ #r   c                ó"   <€ V ^8„  d   QhRRRR/# )r   Údtypeztorch.dtypeÚreturn© )r   r   s   "€r   r   r   7   s   ø€ ÷ ñ  -ð °Mñ r   c                óF   € V\         P                  8w  d   \        R 4      hV# )zdYou cannot use any type other than torch.float16 for SpQR. Please set it totorch.float16 explicitly.)r!   Úfloat16Ú
ValueError)r   r*   s   &&r   Úupdate_dtypeÚSpQRHfQuantizer.update_dtype7   s%   € Ø”E—M‘MÔ!ÜØvóð ð ˆr   c                ó   <€ V ^8„  d   QhRR/# )r   Úmodelr   r,   )r   r   s   "€r   r   r   >   s   ø€ ÷ 
ñ 
à ñ
r   c                ó´   € V P                  WP                  P                  VP                  4      V n        \	        VV P                  V P                  R 7       R# ))r   Úmodules_to_not_convertN)Úget_modules_to_not_convertr   r5   Ú_keep_in_fp32_modulesr   )r   r3   r   s   &&,r   Ú$_process_model_before_weight_loadingÚ4SpQRHfQuantizer._process_model_before_weight_loading>   sM   € ð
 '+×&EÑ&EØ×+Ñ+×BÑBÀE×D_ÑD_ó'
ˆÔ#ô 	!ØØ $× 8Ñ 8Ø#'×#>Ñ#>÷	
r   c                ó   € R # )Fr,   ©r   s   &r   Úis_trainableÚSpQRHfQuantizer.is_trainableL   s   € ár   c                ó   € R # )Tr,   r;   s   &r   Úis_serializableÚSpQRHfQuantizer.is_serializableP   s   € Ùr   c                ó$   <€ V ^8„  d   Qh/ R;R&   # )r   r   r   r,   )r   r   s   "€r   r   r   "   s   ø‡ ‚ ð &Ñ%ò r   )r5   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úrequires_calibrationr   r'   r0   r8   Úpropertyr<   r?   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   r   s   @@r   r   r   "   sW   ù‡ € ñð  Ð÷8ó 8òh÷ð ÷
ð 
ð ñó ðò÷] … r   r   )Útypingr   Úbaser   Úmodeling_utilsr   Úutils.quantization_configr   Úintegrationsr   Úutilsr   r	   r
   r   r   r!   Ú
get_loggerrB   Úloggerr   r,   r   r   Ú<module>rU      sN   ðõ !å ÷ Ý0Ý6å 3ß [Ó [Ý ?ñ ×ÒÛà	×	Ò	˜HÓ	%€ô/�kö /r   