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

ENH: vLLM auto tensor parallel #480

Merged
merged 1 commit into from
Sep 21, 2023
Merged
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
6 changes: 6 additions & 0 deletions xinference/model/llm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def _has_cuda_device():

return cuda_count() > 0

@staticmethod
def _get_cuda_count():
from xorbits._mars.resource import cuda_count

return cuda_count()

@abstractmethod
def load(self):
raise NotImplementedError
Expand Down
4 changes: 3 additions & 1 deletion xinference/model/llm/vllm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def _sanitize_model_config(
if model_config is None:
model_config = VLLMModelConfig()

cuda_count = self._get_cuda_count()

model_config.setdefault("tokenizer_mode", "auto")
model_config.setdefault("trust_remote_code", False)
model_config.setdefault("tensor_parallel_size", 1)
model_config.setdefault("tensor_parallel_size", cuda_count)
model_config.setdefault("block_size", 16)
model_config.setdefault("swap_space", 4)
model_config.setdefault("gpu_memory_utilization", 0.90)
Expand Down