From 8ed722b8a98ec1be6cb1a70a7ffc0d4e9960fbc6 Mon Sep 17 00:00:00 2001 From: Derek Whatley Date: Wed, 13 Nov 2024 16:42:35 -0500 Subject: [PATCH] Add empty tokenizer back to image retrieval test --- .../converters/image_retrieval_converter.py | 10 +++------- .../tests/test_image_retrieval_converter.py | 18 ++++++++---------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/genai-perf/genai_perf/inputs/converters/image_retrieval_converter.py b/genai-perf/genai_perf/inputs/converters/image_retrieval_converter.py index 768233e3..0c8196b2 100644 --- a/genai-perf/genai_perf/inputs/converters/image_retrieval_converter.py +++ b/genai-perf/genai_perf/inputs/converters/image_retrieval_converter.py @@ -54,14 +54,10 @@ def convert( return request_body - def _create_payload( - self, row: DataRow, config: InputsConfig - ) -> Dict[Any, Any]: + def _create_payload(self, row: DataRow, config: InputsConfig) -> Dict[Any, Any]: content = self._retrieve_content(row, config) - payload = { - "input": content - } + payload = {"input": content} return payload def _retrieve_content( @@ -87,4 +83,4 @@ def _add_multi_modal_content(self, entry: DataRow) -> List[Dict[Any, Any]]: }, } ) - return content \ No newline at end of file + return content diff --git a/genai-perf/tests/test_image_retrieval_converter.py b/genai-perf/tests/test_image_retrieval_converter.py index 2e34a7c7..bce2b343 100644 --- a/genai-perf/tests/test_image_retrieval_converter.py +++ b/genai-perf/tests/test_image_retrieval_converter.py @@ -34,6 +34,7 @@ FileData, GenericDataset, ) +from genai_perf.tokenizer import get_empty_tokenizer class TestImageRetrievalConverter: @@ -66,7 +67,7 @@ def clean_image(row): ) } ) - + def test_convert_multi_modal_batched(self) -> None: """ Test batched multi-modal format of OpenAI Chat API for Image Retrieval @@ -80,6 +81,7 @@ def test_convert_multi_modal_batched(self) -> None: config = InputsConfig( extra_inputs={}, output_format=OutputFormat.IMAGE_RETRIEVAL, + tokenizer=get_empty_tokenizer(), ) image_retrieval_converter = ImageRetrievalConverter() @@ -90,18 +92,14 @@ def test_convert_multi_modal_batched(self) -> None: { "payload": [ { - "input": [{ - "type": "image_url", - "url": "test_image_1" - }, - { - "type": "image_url", - "url": "test_image_2" - }] + "input": [ + {"type": "image_url", "url": "test_image_1"}, + {"type": "image_url", "url": "test_image_2"}, + ] } ] }, ] } - + assert result == expected_result