{
"name": "ImportError",
"message": "Using bitsandbytes 8-bit quantization requires the latest version of bitsandbytes: pip install -U bitsandbytes",
"stack": "---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[5], line 1
----> 1 model = AutoModelForCausalLM.from_pretrained(
2 MODEL_NAME,
3 load_in_8bit=True,
4 torch_dtype=torch.bfloat16,
5 device_map="auto"
6 )
7 model.eval()
File ~/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:564, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
562 elif type(config) in cls._model_mapping.keys():
563 model_class = _get_model_class(config, cls._model_mapping)
--> 564 return model_class.from_pretrained(
565 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
566 )
567 raise ValueError(
568 f"Unrecognized configuration class {config.class} for this kind of AutoModel: {cls.name}.
"
569 f"Model type should be one of {', '.join(c.name for c in cls._model_mapping.keys())}."
570 )
File ~/.local/lib/python3.10/site-packages/transformers/modeling_utils.py:3398, in PreTrainedModel.from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, *model_args, **kwargs)
3395 hf_quantizer = None
3397 if hf_quantizer is not None:
-> 3398 hf_quantizer.validate_environment(
3399 torch_dtype=torch_dtype, from_tf=from_tf, from_flax=from_flax, device_map=device_map
3400 )
3401 torch_dtype = hf_quantizer.update_torch_dtype(torch_dtype)
3402 device_map = hf_quantizer.update_device_map(device_map)
File ~/.local/lib/python3.10/site-packages/transformers/quantizers/quantizer_bnb_8bit.py:67, in Bnb8BitHfQuantizer.validate_environment(self, *args, **kwargs)
65 raise ImportError("Using bitsandbytes 8-bit quantization requires Accelerate: pip install accelerate")
66 if not is_bitsandbytes_available():
---> 67 raise ImportError(
68 "Using bitsandbytes 8-bit quantization requires the latest version of bitsandbytes: pip install -U bitsandbytes"
69 )
71 if kwargs.get("from_tf", False) or kwargs.get("from_flax", False):
72 raise ValueError(
73 "Converting into 4-bit or 8-bit weights from tf/flax weights is currently not supported, please make"
74 " sure the weights are in PyTorch format."
75 )
ImportError: Using bitsandbytes 8-bit quantization requires the latest version of bitsandbytes: pip install -U bitsandbytes"
}