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