Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def adjust_target_dtype(self, target_dtype: "torch.dtype") -> "torch.dtype":
if target_dtype != torch.int8:
from accelerate.utils import CustomDtype

logger.info("target_dtype {target_dtype} is replaced by `CustomDtype.INT4` for 4-bit BnB quantization")
logger.info(f"target_dtype {target_dtype} is replaced by `CustomDtype.INT4` for 4-bit BnB quantization")
return CustomDtype.INT4
else:
raise ValueError(f"Wrong `target_dtype` ({target_dtype}) provided.")
Expand Down Expand Up @@ -245,8 +245,7 @@ def update_device_map(self, device_map):
device_map = {"": current_device}
logger.info(
"The device_map was not initialized. "
"Setting device_map to {"
": {current_device}}. "
f"Setting device_map to {{'': {current_device}}}. "
"If you want to use the model for inference, please set device_map ='auto' "
)
return device_map
Expand Down Expand Up @@ -416,15 +415,14 @@ def update_device_map(self, device_map):
device_map = {"": current_device}
logger.info(
"The device_map was not initialized. "
"Setting device_map to {"
": {current_device}}. "
f"Setting device_map to {{'': {current_device}}}. "
"If you want to use the model for inference, please set device_map ='auto' "
)
return device_map

def adjust_target_dtype(self, target_dtype: "torch.dtype") -> "torch.dtype":
if target_dtype != torch.int8:
logger.info("target_dtype {target_dtype} is replaced by `torch.int8` for 8-bit BnB quantization")
logger.info(f"target_dtype {target_dtype} is replaced by `torch.int8` for 8-bit BnB quantization")
return torch.int8

def check_if_quantized_param(
Expand Down