[Hardware][CPU] using current_platform.is_cpu (#9536)

This commit is contained in:
wangshuai09
2024-10-22 00:50:43 -07:00
committed by GitHub
parent 0d02747f2e
commit 3ddbe25502
17 changed files with 60 additions and 64 deletions
+4 -4
View File
@@ -5,8 +5,8 @@ import torch
from vllm.config import ModelConfig, TaskOption
from vllm.inputs import InputContext
from vllm.platforms import current_platform
from vllm.sequence import Logprob, PromptLogprobs, SampleLogprobs
from vllm.utils import is_cpu
TokensText = Tuple[List[int], str]
@@ -19,7 +19,7 @@ def check_outputs_equal(
name_1: str,
):
"""
Compare the two sequences generated by different models,
Compare the two sequences generated by different models,
which should be equal.
"""
assert len(outputs_0_lst) == len(outputs_1_lst)
@@ -255,7 +255,7 @@ def build_model_context(model_name: str,
mm_processor_kwargs: Optional[Dict] = None,
limit_mm_per_prompt: Optional[Dict] = None):
"""Creates an InputContext for a given model.
Args:
model_name: Name of the model being considered.
tokenizer_name: Name of the tokenizer being considered.
@@ -270,7 +270,7 @@ def build_model_context(model_name: str,
if tokenizer_name is None:
tokenizer_name = model_name
if dtype is None:
dtype = "bfloat16" if is_cpu() else "half"
dtype = "bfloat16" if current_platform.is_cpu() else "half"
model_config = ModelConfig(
model_name,