bitsandbytes icon indicating copy to clipboard operation
bitsandbytes copied to clipboard

Regarding bnb import error

Open Mubashirshariq opened this issue 1 year ago • 2 comments

System Info

Ubuntu

Reproduction

model_id = "google/gemma-2b" bnb_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16 )

model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", quantization_config=bnb_config)

Expected behavior

when i am running the above snipped it is giving the error

'[/usr/local/lib/python3.10/dist-packages/transformers/quantizers/quantizer_bnb_4bit.py](https://localhost:8080/#) in validate_environment(self, *args, **kwargs) 60 def validate_environment(self, *args, **kwargs): 61 if not (is_accelerate_available() and is_bitsandbytes_available()): ---> 62 raise ImportError( 63 "Using bitsandbytes8-bit quantization requires Accelerate:pip install accelerate 64 "and the latest version of bitsandbytes:pip install -i https://pypi.org/simple/ bitsandbytes`

ImportError: Using bitsandbytes 8-bit quantization requires Accelerate: pip install accelerate and the latest version of bitsandbytes: pip install -i https://pypi.org/simple/ bitsandbytes

i had already installed the two packages !pip install accelerate !pip install -i https://pypi.org/simple/ bitsandbytes

Mubashirshariq avatar Aug 06 '24 13:08 Mubashirshariq

@Mubashirshariq Please try upgrading these packages with: pip install -U transformers accelerate bitsandbytes

matthewdouglas avatar Aug 08 '24 15:08 matthewdouglas

I tried that also still getting the same error

Mubashirshariq avatar Aug 09 '24 03:08 Mubashirshariq

We noticed that there has been no recent activity on this issue. As a result, we will be closing it for now. If you continue to experience this problem or have additional information to provide, please feel free to reopen the issue or create a new one.

Thank you for your understanding.

matthewdouglas avatar Feb 28 '25 14:02 matthewdouglas