bitsandbytes icon indicating copy to clipboard operation
bitsandbytes copied to clipboard

AttributeError: 'Parameter' object has no attribute 'SCB'

Open fountainheadpro opened this issue 3 years ago • 6 comments

bin /home/paperspace/.local/lib/python3.9/site-packages/bitsandbytes/libbitsandbytes_cuda117_nocublaslt.so /home/paperspace/.local/lib/python3.9/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/home/paperspace/.local/lib/python3.9/site-packages/cv2/../../lib64')} warn(msg) CUDA SETUP: CUDA runtime path found: /usr/local/cuda-11.7/lib64/libcudart.so CUDA SETUP: Highest compute capability among GPUs detected: 5.2 CUDA SETUP: Detected CUDA version 117 /home/paperspace/.local/lib/python3.9/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: WARNING: Compute capability < 7.5 detected! Only slow 8-bit matmul is supported for your GPU! warn(msg) CUDA SETUP: Loading binary /home/paperspace/.local/lib/python3.9/site-packages/bitsandbytes/libbitsandbytes_cuda117_nocublaslt.so... Traceback (most recent call last): File "/home/paperspace/Caption-Anything/app_langchain.py", line 28, in shared_captioner = build_captioner(args.captioner, args.device, args) File "/home/paperspace/Caption-Anything/caption_anything/captioner/init.py", line 11, in build_captioner return BLIP2Captioner(device, enable_filter=args.clip_filter) File "/home/paperspace/Caption-Anything/caption_anything/captioner/blip2.py", line 24, in init self.model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", File "/home/paperspace/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2829, in from_pretrained ) = cls._load_pretrained_model( File "/home/paperspace/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2937, in _load_pretrained_model model_state_dict = model.state_dict() File "/home/paperspace/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1310, in state_dict module.state_dict(destination, prefix + name + '.', keep_vars=keep_vars) File "/home/paperspace/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1310, in state_dict module.state_dict(destination, prefix + name + '.', keep_vars=keep_vars) File "/home/paperspace/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1307, in state_dict self._save_to_state_dict(destination, prefix, keep_vars) File "/home/paperspace/.local/lib/python3.9/site-packages/bitsandbytes/nn/modules.py", line 344, in _save_to_state_dict param_from_weight = getattr(self.weight, weight_name)

fountainheadpro avatar May 30 '23 00:05 fountainheadpro

Same error for me, as well. This was ChatGPT's (not helpful) answer:

The error message suggests that the 'Parameter' object does not have an attribute named 'SCB'. This error is occurring in the _save_to_state_dict method of the bitsandbytes.nn.modules module.

It appears that the Blip2ForConditionalGeneration model from the Salesforce/blip2-opt-6.7b checkpoint is trying to access the 'SCB' attribute from the weight parameter, but it doesn't exist.

To resolve this issue, you can try the following:

Update the bitsandbytes library to the latest version, as newer versions may have addressed this issue.

Use a different version of the Salesforce/blip2-opt checkpoint that is compatible with your current code.

Contact the developers of the bitsandbytes library or the Salesforce/blip2-opt checkpoint for assistance in resolving the attribute error.

Make sure to check the documentation and release notes of both the bitsandbytes library and the Salesforce/blip2-opt checkpoint for any specific instructions or known issues related to attribute errors.

marmelade500 avatar Jun 01 '23 15:06 marmelade500

Did you solve the problem? I have the same problem

1804240505 avatar Jun 03 '23 05:06 1804240505

Same error when loading BLIP2 using Blip2ForConditionalGeneration.from_pretrained(...load_in_8bit=True) packages: torch 2.0.0 bitsandbytes 0.39.0 transformers 4.30.0.dev0 accelerate 0.19.0

Antiman-cmyk avatar Jun 03 '23 16:06 Antiman-cmyk

This might be related to #491. Your GPU does not support the main 8-bit implementations and falls back to the secondary implementations. It seems these implementations have some bugs. I need to look into this further. A minimal script that reproduces this error might be useful, but I do not have access to Maxwell GPUs and it will be difficult to reproduce in any case.

TimDettmers avatar Jul 16 '23 02:07 TimDettmers

Bitsandbytes was not supported windows before, but my method can support windows.(yuhuang) 1 open folder J:\StableDiffusion\sdwebui,Click the address bar of the folder and enter CMD or WIN+R, CMD 。enter,cd /d J:\StableDiffusion\sdwebui 2 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes

3 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes-windows

4 J:\StableDiffusion\sdwebui\py310\python.exe -m pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl

Replace your SD venv directory file(python.exe Folder) here(J:\StableDiffusion\sdwebui\py310)

swumagic avatar Nov 10 '23 07:11 swumagic

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

github-actions[bot] avatar Dec 20 '23 15:12 github-actions[bot]