Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cuda device not found error when LLM is initialized in ray actor #3198

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions vllm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,8 @@ def _verify_args(self) -> None:

class DeviceConfig:

def __init__(self, device: str = "auto") -> None:
if device == "auto":
# Automated device type detection
if torch.cuda.is_available():
self.device_type = "cuda"
elif is_neuron():
self.device_type = "neuron"
else:
raise RuntimeError("No supported device detected.")
else:
# Device type is assigned explicitly
self.device_type = device
def __init__(self, device: str = "cuda") -> None:
self.device_type = device

# Some device types require processing inputs on CPU
if self.device_type in ["neuron"]:
Expand Down
4 changes: 2 additions & 2 deletions vllm/engine/arg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EngineArgs:
lora_extra_vocab_size: int = 256
lora_dtype = 'auto'
max_cpu_loras: Optional[int] = None
device: str = 'auto'
device: str = 'cuda'
ray_workers_use_nsight: bool = False

def __post_init__(self):
Expand Down Expand Up @@ -285,7 +285,7 @@ def add_cli_args(
parser.add_argument("--device",
type=str,
default=EngineArgs.device,
choices=["auto", "cuda", "neuron"],
choices=["cuda", "neuron"],
help='Device type for vLLM execution.')
return parser

Expand Down
Loading