diff --git a/vllm/platforms/interface.py b/vllm/platforms/interface.py index 774d9e071..b53852499 100644 --- a/vllm/platforms/interface.py +++ b/vllm/platforms/interface.py @@ -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)