fix 'BitsAndBytesConfig' object is not subscriptable issue

#2
by tianweidut - opened
Files changed (1) hide show
  1. modeling_baichuan.py +1 -1
modeling_baichuan.py CHANGED
@@ -528,7 +528,7 @@ class BaichuanForCausalLM(BaichuanPreTrainedModel):
528
  self.model = BaichuanModel(config)
529
 
530
  self.lm_head = NormHead(config.hidden_size, config.vocab_size, bias=False)
531
- if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']:
532
  try:
533
  from .quantizer import quantize_offline, init_model_weight_int4
534
  except ImportError:
 
528
  self.model = BaichuanModel(config)
529
 
530
  self.lm_head = NormHead(config.hidden_size, config.vocab_size, bias=False)
531
+ if hasattr(config, "quantization_config") and isinstance(config.quantization_config, dict) and config.quantization_config.get('load_in_4bit', False):
532
  try:
533
  from .quantizer import quantize_offline, init_model_weight_int4
534
  except ImportError: