Files
stable-diffusion-webui-forge/modules_forge/bnb_installer.py
DenOfEquity 7c5ca14ff7 bump versions of bitsandbytes and accelerate (#2658)
for CUDA 12.6 compatibility, and
diffusers 0.31.0 expects accelerate >=0.31.0
2025-02-14 22:47:30 +00:00

22 lines
612 B
Python

import pkg_resources
from modules.launch_utils import run_pip
target_bitsandbytes_version = '0.45.2'
def try_install_bnb():
try:
bitsandbytes_version = pkg_resources.get_distribution('bitsandbytes').version
except Exception:
bitsandbytes_version = None
try:
if bitsandbytes_version != target_bitsandbytes_version:
run_pip(
f"install -U bitsandbytes=={target_bitsandbytes_version}",
f"bitsandbytes=={target_bitsandbytes_version}",
)
except Exception as e:
print(f'Cannot install bitsandbytes. Skipped.')