platforms: Fix Ray DP startup crash (#36665)
Signed-off-by: Itay Alroy <ialroy@nvidia.com>
This commit is contained in:
@@ -638,6 +638,11 @@ class Platform:
|
||||
"""Raises if this request is unsupported on this platform"""
|
||||
|
||||
def __getattr__(self, key: str):
|
||||
# Pickle checks dunder methods like __getstate__. If we return None
|
||||
# for them, pickle treats it like a real value and tries to call it.
|
||||
if key.startswith("__") and key.endswith("__"):
|
||||
raise AttributeError(key)
|
||||
|
||||
device = getattr(torch, self.device_type, None)
|
||||
if device is not None and hasattr(device, key):
|
||||
attr = getattr(device, key)
|
||||
|
||||
Reference in New Issue
Block a user