From 9802dfe93b186d35bbbb5140c85912cf231ed50e Mon Sep 17 00:00:00 2001 From: tastelikefeet <58414341+tastelikefeet@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:23:21 +0800 Subject: [PATCH] fix device error (#419) --- modelscope/utils/torch_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modelscope/utils/torch_utils.py b/modelscope/utils/torch_utils.py index b8e48aa1..1a673458 100644 --- a/modelscope/utils/torch_utils.py +++ b/modelscope/utils/torch_utils.py @@ -359,4 +359,4 @@ def all_gather(data, group=None): def is_on_same_device(model: torch.nn.Module) -> bool: device_set = set(map(lambda p: p.device.type, model.parameters())) - {'cpu'} - return len(device_set) == 1 + return len(device_set) <= 1