File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 8989 # except:
9090 # raise ImportError("Unsloth: Please update unsloth_zoo via `pip install --upgrade --no-cache-dir --no-deps unsloth_zoo`")
9191 import unsloth_zoo
92- except :
93- raise ImportError ("Unsloth: Please install unsloth_zoo via `pip install unsloth_zoo`" )
92+ except NotImplementedError as e :
93+ raise NotImplementedError (str (e ))
94+ except Exception as e :
95+ raise ImportError (f"Unsloth: Please install unsloth_zoo via `pip install unsloth_zoo` Also error = { str (e )} " )
9496pass
9597
9698from unsloth_zoo .device_type import (
Original file line number Diff line number Diff line change @@ -538,7 +538,14 @@ def from_pretrained(
538538 if hasattr (auto_config , "quantization_config" ):
539539 from transformers .quantizers .auto import AUTO_QUANTIZATION_CONFIG_MAPPING
540540 quantization_config = auto_config .quantization_config
541- quantizer = AUTO_QUANTIZATION_CONFIG_MAPPING [quantization_config ["quant_method" ]]
541+ quant_method = quantization_config ["quant_method" ]
542+ # Sometimes bitsandbytes_4bit + bitsandbytes_8bit is provided
543+ if quant_method == "bitsandbytes" and "bitsandbytes" not in AUTO_QUANTIZATION_CONFIG_MAPPING :
544+ if "bitsandbytes_4bit" not in AUTO_QUANTIZATION_CONFIG_MAPPING :
545+ raise KeyError ("Unsloth: AUTO_QUANTIZATION_CONFIG_MAPPING does not have `bitsandbytes_4bit`" )
546+ quantizer = AUTO_QUANTIZATION_CONFIG_MAPPING ["bitsandbytes_4bit" ]
547+ else :
548+ quantizer = AUTO_QUANTIZATION_CONFIG_MAPPING [quant_method ]
542549 quantizer_kwargs = {}
543550 # We cannot dequantize since gpt-oss-20b MXFP4 will now be gpt-oss-20b-BF16
544551 if load_in_16bit and "dequantize" in inspect .signature (quantizer ).parameters :
You can’t perform that action at this time.
0 commit comments