[Hardware][CPU] Add embedding models support for CPU backend (#10193)

Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
Isotr0py
2024-11-11 16:54:28 +08:00
committed by GitHub
parent 9804ac7c7c
commit 58170d6503
9 changed files with 185 additions and 52 deletions

View File

@@ -4,6 +4,8 @@ Run `pytest tests/models/embedding/language/test_embedding.py`.
"""
import pytest
from vllm.utils import current_platform
from ..utils import check_embeddings_close
# Model, Guard
@@ -21,15 +23,14 @@ ENCODER_ONLY = [
@pytest.mark.parametrize("model", MODELS)
@pytest.mark.parametrize("dtype", ["half"])
def test_models(
monkeypatch,
hf_runner,
vllm_runner,
example_prompts,
model,
dtype: str,
) -> None:
if model in ENCODER_ONLY:
monkeypatch.setenv("VLLM_ATTENTION_BACKEND", "XFORMERS")
if model not in ENCODER_ONLY and current_platform.is_cpu():
pytest.skip("Skip large embedding models test on CPU.")
# The example_prompts has ending "\n", for example:
# "Write a short story about a robot that dreams for the first time.\n"