From 38ef94888afc0c2bccc2f18422d2b525d7649ac3 Mon Sep 17 00:00:00 2001 From: Cyrus Leung Date: Tue, 16 Jul 2024 23:59:36 +0800 Subject: [PATCH] [CI/Build] Remove "boardwalk" image asset (#6460) --- tests/conftest.py | 7 +------ tests/models/test_fuyu.py | 7 ++++--- tests/models/test_llava.py | 2 -- tests/models/test_llava_next.py | 2 -- tests/models/test_paligemma.py | 7 ++++--- tests/models/test_phi3v.py | 2 -- vllm/assets/image.py | 13 +++---------- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 17f75d948c543..08b8814d983d3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,7 +39,6 @@ def _read_prompts(filename: str) -> List[str]: class _ImageAssetPrompts(TypedDict): stop_sign: str cherry_blossom: str - boardwalk: str if sys.version_info < (3, 9): @@ -58,7 +57,6 @@ def __init__(self) -> None: super().__init__([ ImageAsset("stop_sign"), ImageAsset("cherry_blossom"), - ImageAsset("boardwalk") ]) def prompts(self, prompts: _ImageAssetPrompts) -> List[str]: @@ -68,10 +66,7 @@ def prompts(self, prompts: _ImageAssetPrompts) -> List[str]: The order of the returned prompts matches the order of the assets when iterating through this object. """ - return [ - prompts["stop_sign"], prompts["cherry_blossom"], - prompts["boardwalk"] - ] + return [prompts["stop_sign"], prompts["cherry_blossom"]] IMAGE_ASSETS = _ImageAssets() diff --git a/tests/models/test_fuyu.py b/tests/models/test_fuyu.py index 672470acb77e6..25f63a3d64d0e 100644 --- a/tests/models/test_fuyu.py +++ b/tests/models/test_fuyu.py @@ -12,9 +12,10 @@ pytestmark = pytest.mark.vlm HF_IMAGE_PROMPTS = IMAGE_ASSETS.prompts({ - "stop_sign": "What's the content of the image?\n", # noqa: E501 - "cherry_blossom": "What is the season?\n", - "boardwalk": "What's in this image?\n", + "stop_sign": + "What's the content of the image?\n", + "cherry_blossom": + "What is the season?\n", }) models = ["adept/fuyu-8b"] diff --git a/tests/models/test_llava.py b/tests/models/test_llava.py index 2c0a8d4ffdf5c..79ab58c364f64 100644 --- a/tests/models/test_llava.py +++ b/tests/models/test_llava.py @@ -16,8 +16,6 @@ "USER: \nWhat's the content of the image?\nASSISTANT:", "cherry_blossom": "USER: \nWhat is the season?\nASSISTANT:", - "boardwalk": - "USER: \nWhat's in this image?\nASSISTANT:", }) IMAGE_TOKEN_ID = 32000 diff --git a/tests/models/test_llava_next.py b/tests/models/test_llava_next.py index 163741a5719c2..2f200c13ea001 100644 --- a/tests/models/test_llava_next.py +++ b/tests/models/test_llava_next.py @@ -23,8 +23,6 @@ f"{_PREFACE} USER: \nWhat's the content of the image? ASSISTANT:", "cherry_blossom": f"{_PREFACE} USER: \nWhat is the season? ASSISTANT:", - "boardwalk": - f"{_PREFACE} USER: \nWhat's in this image? ASSISTANT:", }) IMAGE_TOKEN_ID = 32000 diff --git a/tests/models/test_paligemma.py b/tests/models/test_paligemma.py index b0e7264e89118..81afd11a6e697 100644 --- a/tests/models/test_paligemma.py +++ b/tests/models/test_paligemma.py @@ -12,9 +12,10 @@ pytestmark = pytest.mark.vlm HF_IMAGE_PROMPTS = IMAGE_ASSETS.prompts({ - "stop_sign": "caption es", - "cherry_blossom": "What is in the picture?", - "boardwalk": "What is in the picture?", + "stop_sign": + "caption es", + "cherry_blossom": + "What is in the picture?", }) IMAGE_TOKEN_ID = 257152 diff --git a/tests/models/test_phi3v.py b/tests/models/test_phi3v.py index faadab22429ba..636a9d3f1a65e 100644 --- a/tests/models/test_phi3v.py +++ b/tests/models/test_phi3v.py @@ -18,8 +18,6 @@ "<|user|>\n<|image_1|>\nWhat's the content of the image?<|end|>\n<|assistant|>\n", # noqa: E501 "cherry_blossom": "<|user|>\n<|image_1|>\nWhat is the season?<|end|>\n<|assistant|>\n", - "boardwalk": - "<|user|>\n<|image_1|>\nWhat's in this image?<|end|>\n<|assistant|>\n", }) models = ["microsoft/Phi-3-vision-128k-instruct"] diff --git a/vllm/assets/image.py b/vllm/assets/image.py index a526db735ffc7..ca6c3ac9e3a38 100644 --- a/vllm/assets/image.py +++ b/vllm/assets/image.py @@ -1,13 +1,11 @@ import shutil from dataclasses import dataclass -from functools import cached_property, lru_cache +from functools import lru_cache from typing import Literal import requests from PIL import Image -from vllm.multimodal.utils import fetch_image - from .base import get_cache_dir @@ -35,13 +33,8 @@ def get_air_example_data_2_asset(filename: str) -> Image.Image: @dataclass(frozen=True) class ImageAsset: - name: Literal["stop_sign", "cherry_blossom", "boardwalk"] + name: Literal["stop_sign", "cherry_blossom"] - @cached_property + @property def pil_image(self) -> Image.Image: - if self.name == "boardwalk": - return fetch_image( - "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - ) - return get_air_example_data_2_asset(f"{self.name}.jpg")