Skip to content

Commit

Permalink
Add empty tokenizer back to image retrieval test
Browse files Browse the repository at this point in the history
  • Loading branch information
djwhatle committed Nov 13, 2024
1 parent eff74c8 commit 8ed722b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -87,4 +83,4 @@ def _add_multi_modal_content(self, entry: DataRow) -> List[Dict[Any, Any]]:
},
}
)
return content
return content
18 changes: 8 additions & 10 deletions genai-perf/tests/test_image_retrieval_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
FileData,
GenericDataset,
)
from genai_perf.tokenizer import get_empty_tokenizer


class TestImageRetrievalConverter:
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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

0 comments on commit 8ed722b

Please sign in to comment.