test_prithvi_mae.py 1.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

import pytest
import torch

from ....conftest import VllmRunner


def _run_test(
    vllm_runner: type[VllmRunner],
    model: str,
) -> None:
    prompt = [
        {
            # This model deals with no text input
            "prompt_token_ids": [1],
18
19
20
21
22
23
            "multi_modal_data": {
                "image": {
                    "pixel_values": torch.ones((6, 512, 512), dtype=torch.float16),
                    "location_coords": torch.ones((1, 2), dtype=torch.float16),
                }
            },
24
25
        }
        for _ in range(10)
26
27
    ]

28
    with vllm_runner(
29
30
31
32
33
        model,
        runner="pooling",
        dtype="half",
        enforce_eager=True,
        skip_tokenizer_init=True,
34
        enable_mm_embeds=True,
35
36
37
38
        # Limit the maximum number of sequences to avoid the
        # test going OOM during the warmup run
        max_num_seqs=32,
        default_torch_num_threads=1,
39
    ) as vllm_model:
40
        vllm_model.llm.encode(prompt, pooling_task="plugin")
41
42


43
MODELS = ["mgazz/Prithvi-EO-2.0-300M-TL-Sen1Floods11"]
44
45
46
47
48
49
50
51
52
53
54
55
56
57


@pytest.mark.core_model
@pytest.mark.parametrize("model", MODELS)
def test_models_image(
    hf_runner,
    vllm_runner,
    image_assets,
    model: str,
) -> None:
    _run_test(
        vllm_runner,
        model,
    )