Unverified Commit 6e9cc73f authored by Ning Xie's avatar Ning Xie Committed by GitHub
Browse files

[MISC] correct DeviceConfig device field static type analysis (#19699)


Signed-off-by: default avatarAndy Xie <andy.xning@gmail.com>
parent c53711bd
...@@ -2285,7 +2285,7 @@ Device = Literal["auto", "cuda", "neuron", "cpu", "tpu", "xpu", "hpu"] ...@@ -2285,7 +2285,7 @@ Device = Literal["auto", "cuda", "neuron", "cpu", "tpu", "xpu", "hpu"]
class DeviceConfig: class DeviceConfig:
"""Configuration for the device to use for vLLM execution.""" """Configuration for the device to use for vLLM execution."""
device: SkipValidation[Union[Device, torch.device]] = "auto" device: SkipValidation[Optional[Union[Device, torch.device]]] = "auto"
"""Device type for vLLM execution. """Device type for vLLM execution.
This parameter is deprecated and will be This parameter is deprecated and will be
removed in a future release. removed in a future release.
...@@ -2327,7 +2327,10 @@ class DeviceConfig: ...@@ -2327,7 +2327,10 @@ class DeviceConfig:
"to turn on verbose logging to help debug the issue.") "to turn on verbose logging to help debug the issue.")
else: else:
# Device type is assigned explicitly # Device type is assigned explicitly
self.device_type = self.device if isinstance(self.device, str):
self.device_type = self.device
elif isinstance(self.device, torch.device):
self.device_type = self.device.type
# Some device types require processing inputs on CPU # Some device types require processing inputs on CPU
if self.device_type in ["neuron"]: if self.device_type in ["neuron"]:
......
...@@ -1018,7 +1018,8 @@ class EngineArgs: ...@@ -1018,7 +1018,8 @@ class EngineArgs:
from vllm.platforms import current_platform from vllm.platforms import current_platform
current_platform.pre_register_and_update() current_platform.pre_register_and_update()
device_config = DeviceConfig(device=current_platform.device_type) device_config = DeviceConfig(
device=cast(Device, current_platform.device_type))
model_config = self.create_model_config() model_config = self.create_model_config()
# * If VLLM_USE_V1 is unset, we enable V1 for "supported features" # * If VLLM_USE_V1 is unset, we enable V1 for "supported features"
......
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