From 2b8b2f159f81507e86f903dd1612104c3d3fa93f Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 21 Nov 2024 04:01:17 -0800 Subject: [PATCH] Update vision.py --- unsloth/models/vision.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py index 237673f10c..87a3846fdb 100644 --- a/unsloth/models/vision.py +++ b/unsloth/models/vision.py @@ -54,7 +54,7 @@ def _wrap_fast_inference(generate, device_type, dtype, model): kwargs["pad_token_id"] = kwargs.pop("pad_token_id", model_eos_token_id) # Autocasted - with torch.autocast(device_type = device_type, dtype = dtype): + with torch.autocast(device_type = model.device.type, dtype = dtype): output = generate(*args, **kwargs) pass return output