mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 19:21:31 +06:00
parent
fd65aa9818
commit
6b39470b74
@ -2781,7 +2781,12 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
|
||||
quantization_method_from_config = config.quantization_config.get(
|
||||
"quant_method", QuantizationMethod.BITS_AND_BYTES
|
||||
)
|
||||
|
||||
if quantization_method_from_config is not None and quantization_method_from_args is not None:
|
||||
if quantization_method_from_config != quantization_method_from_args:
|
||||
raise ValueError(
|
||||
f"The model is already quantized with {quantization_method_from_config}. "
|
||||
f"You can't quantize it again with {quantization_method_from_args}"
|
||||
)
|
||||
if quantization_method_from_config == QuantizationMethod.GPTQ and quantization_method_from_args is not None:
|
||||
loading_attr_dict = quantization_config.get_loading_attributes()
|
||||
for attr, val in loading_attr_dict.items():
|
||||
|
Loading…
Reference in New Issue
Block a user