From 42b29a35acaef978b6b73db8ad456ca1a2a99140 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:21:06 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- unsloth/models/vision.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 57b0d02c3e..284b29f45b 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -190,6 +190,7 @@ def _attach_bnb_multidevice_hooks( } except Exception as exc: import warnings + warnings.warn( "Unsloth: Failed to determine CUDA devices from model parameters, " f"so multi-GPU hooks cannot be attached. ({type(exc).__name__}: {exc})", @@ -251,7 +252,9 @@ def _attach_bnb_multidevice_hooks( # add a root-level AlignDevicesHook to route inputs. if len(cuda_devs) == 1 and not hasattr(model, "_hf_hook"): main_device = next(iter(cuda_devs)) - add_hook_to_module(model, AlignDevicesHook(execution_device = main_device)) + add_hook_to_module( + model, AlignDevicesHook(execution_device = main_device) + ) desc = f"{len(inferred_map)} block(s) across {len(cuda_devs)} device(s)" finally: