[platforms] improve error message for unspecified platforms (#10520)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
parent
3430857b64
commit
aaddce5d26
@ -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 = ""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user