[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d6b758035a
commit
bf3171e567
2 changed files with 6 additions and 4 deletions
|
|
@ -2494,12 +2494,13 @@ class FastLlamaModel:
|
|||
# loads. The bnb loading path places weights on CUDA devices but
|
||||
# never calls dispatch_model, so no hooks are installed.
|
||||
from unsloth.models.vision import _attach_bnb_multidevice_hooks
|
||||
|
||||
_attach_bnb_multidevice_hooks(
|
||||
model,
|
||||
load_in_4bit = load_in_4bit,
|
||||
load_in_8bit = False,
|
||||
load_in_4bit = load_in_4bit,
|
||||
load_in_8bit = False,
|
||||
offload_embedding = False,
|
||||
fast_inference = False,
|
||||
fast_inference = False,
|
||||
)
|
||||
model.fast_generate = make_fast_generate_wrapper(model.generate)
|
||||
model.fast_generate_batches = None
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ def _attach_bnb_multidevice_hooks(
|
|||
# so torch.device("cpu") must become "cpu", not stay as an object.
|
||||
device_map_int = {
|
||||
k: (v.index if v.type == "cuda" else v.type)
|
||||
if isinstance(v, torch.device) else v
|
||||
if isinstance(v, torch.device)
|
||||
else v
|
||||
for k, v in inferred_map.items()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue