fix device error (#419)

This commit is contained in:
tastelikefeet
2023-07-27 16:23:21 +08:00
committed by GitHub
parent 66cf72a75c
commit 9802dfe93b

View File

@@ -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