@@ -122,8 +122,6 @@ def from_pretrained(
122122 quantize: Whether to quantize the model
123123 config_override: Dict to override any auto-detected settings
124124 config: Shared export/push config (format, quantization, push_format, etc.)
125- quantize: Whether to quantize the model
126- config_override: Dict to override any auto-detected settings
127125 verbose: Print loading progress
128126
129127 Returns:
@@ -1009,10 +1007,16 @@ def export(
10091007 >>> model.export("onnx", "./my_model_onnx/")
10101008 >>> model.export("mlx", "./my_model_mlx/", quantization="4bit")
10111009 """
1012- format = (format or self .export_push_config ["format" ]).lower ()
1010+ format = (
1011+ format
1012+ if format is not None
1013+ else self .export_push_config .get ("format" , DEFAULT_EXPORT_PUSH_CONFIG ["format" ])
1014+ ).lower ()
10131015 effective_quantization = quantization
10141016 if effective_quantization is None and format == "gguf" :
1015- effective_quantization = self .export_push_config ["quantization" ]
1017+ effective_quantization = self .export_push_config .get (
1018+ "quantization" , DEFAULT_EXPORT_PUSH_CONFIG ["quantization" ]
1019+ )
10161020
10171021 # Merge LoRA if applied
10181022 if self ._lora_applied :
@@ -1025,7 +1029,7 @@ def export(
10251029 if output_path is None :
10261030 model_name = self .model .config ._name_or_path .split ('/' )[- 1 ]
10271031 if format == "gguf" :
1028- quant = effective_quantization or "Q4_K_M"
1032+ quant = effective_quantization
10291033 output_path = f"{ model_name } .{ quant .upper ()} .gguf"
10301034 elif format == "safetensors" :
10311035 output_path = f"./{ model_name } -quantllm/"
@@ -1086,8 +1090,14 @@ def push_to_hub(
10861090 """
10871091 from ..hub import QuantLLMHubManager
10881092
1089- format_lower = (format or self .export_push_config ["push_format" ]).lower ()
1090- push_quantization = quantization or self .export_push_config ["push_quantization" ]
1093+ format_lower = (
1094+ format
1095+ if format is not None
1096+ else self .export_push_config .get ("push_format" , DEFAULT_EXPORT_PUSH_CONFIG ["push_format" ])
1097+ ).lower ()
1098+ push_quantization = quantization or self .export_push_config .get (
1099+ "push_quantization" , DEFAULT_EXPORT_PUSH_CONFIG ["push_quantization" ]
1100+ )
10911101
10921102 # Get the original base model name (full path for HuggingFace link)
10931103 base_model_full = self .model .config ._name_or_path
@@ -1101,7 +1111,7 @@ def push_to_hub(
11011111
11021112 if format_lower == "gguf" :
11031113 # Export GGUF directly to staging
1104- quant_label = push_quantization or "Q4_K_M"
1114+ quant_label = push_quantization
11051115 filename = f"{ model_name } .{ quant_label .upper ()} .gguf"
11061116 save_path = os .path .join (manager .staging_dir , filename )
11071117
0 commit comments