Unverified Commit aaddce5d authored by youkaichao's avatar youkaichao Committed by GitHub
Browse files

[platforms] improve error message for unspecified platforms (#10520)


Signed-off-by: default avataryoukaichao <youkaichao@gmail.com>
parent 3430857b
......@@ -1191,12 +1191,13 @@ class SchedulerConfig:
class DeviceConfig:
device: Optional[torch.device]
device_type: str
def __init__(self, device: str = "auto") -> None:
if device == "auto":
# Automated device type detection
self.device_type = current_platform.device_type
if self.device_type is None:
if not self.device_type:
raise RuntimeError("Failed to infer device type")
else:
# Device type is assigned explicitly
......
......@@ -170,3 +170,4 @@ class Platform:
class UnspecifiedPlatform(Platform):
_enum = PlatformEnum.UNSPECIFIED
device_type = ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment