Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
SunMarc committed Nov 15, 2024
1 parent 6b39064 commit bf57c70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/accelerate/big_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ def dispatch_model(
# We need to force hook for quantized model that can't be moved with to()
if getattr(model, "quantization_method", "bitsandbytes") == "bitsandbytes":
# since bnb 0.43.2, we can move 4-bit model
if getattr(model, "is_loaded_in_8bit", False) or (getattr(model, "is_loaded_in_4bit", False) and not is_bnb_available(min_version="0.43.2")):
if getattr(model, "is_loaded_in_8bit", False) or (
getattr(model, "is_loaded_in_4bit", False) and not is_bnb_available(min_version="0.43.2")
):
force_hooks = True

# We attach hooks if the device_map has at least 2 different devices or if
Expand Down

0 comments on commit bf57c70

Please sign in to comment.