[Refactor] Replace hardcoded CUDA device selection with platform-agnostic API (#4496)
Signed-off-by: Nick Cao <ncao@redhat.com>
This commit is contained in:
1 parent
64efa66869
commit
67d14b5ac4
15 files changed
+34
-16
No files matched your search
@@ -248,6 +248,10 @@ class UnspecifiedOmniPlatform(OmniPlatform):
|
||||
_enum = PlatformEnum.UNSPECIFIED
|
||||
device_type = "cpu"
|
||||
|
||||
@classmethod
|
||||
def get_torch_device(cls, local_rank: int | None = None) -> torch.device:
|
||||
return torch.device("cpu")
|
||||
|
||||
@classmethod
|
||||
def get_device_count(cls) -> int:
|
||||
return 0
|
||||
Reference in new issue
Block a user