Unverified Commit aa72d9a4 authored by Michael Goin's avatar Michael Goin Committed by GitHub
Browse files

Mistral-format support for compressed-tensors (#16803)


Signed-off-by: default avatarmgoin <mgoin64@gmail.com>
parent ce17db80
...@@ -690,6 +690,9 @@ def load_params_config(model: Union[str, Path], revision: Optional[str], ...@@ -690,6 +690,9 @@ def load_params_config(model: Union[str, Path], revision: Optional[str],
"quant_method": "fp8", "quant_method": "fp8",
"activation_scheme": "static" "activation_scheme": "static"
} }
elif quantization.get("quant_method") == "compressed-tensors":
# Pass through the quantization config to compressed-tensors
quantization_config = quantization
else: else:
raise ValueError( raise ValueError(
f"Found unknown quantization='{quantization}' in config") f"Found unknown quantization='{quantization}' in config")
...@@ -707,6 +710,7 @@ def load_params_config(model: Union[str, Path], revision: Optional[str], ...@@ -707,6 +710,7 @@ def load_params_config(model: Union[str, Path], revision: Optional[str],
if config_type == "multimodal": if config_type == "multimodal":
multimodal_config = config_dict.pop("vision_encoder") multimodal_config = config_dict.pop("vision_encoder")
quantization_config = config_dict.get("quantization_config", {})
config_dict = { config_dict = {
"text_config": config_dict, "text_config": config_dict,
...@@ -714,6 +718,8 @@ def load_params_config(model: Union[str, Path], revision: Optional[str], ...@@ -714,6 +718,8 @@ def load_params_config(model: Union[str, Path], revision: Optional[str],
} }
config_dict["architectures"] = ["PixtralForConditionalGeneration"] config_dict["architectures"] = ["PixtralForConditionalGeneration"]
config_dict["model_type"] = "pixtral" config_dict["model_type"] = "pixtral"
if quantization_config:
config_dict["quantization_config"] = quantization_config
config_dict.update(kwargs) config_dict.update(kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment