diff --git a/integration-tests/images/chicken_on_money.png b/integration-tests/images/chicken_on_money.png new file mode 100644 index 00000000..1a4e0440 Binary files /dev/null and b/integration-tests/images/chicken_on_money.png differ diff --git a/integration-tests/models/test_idefics.py b/integration-tests/models/test_idefics.py index e49e9c12..f38b9cde 100644 --- a/integration-tests/models/test_idefics.py +++ b/integration-tests/models/test_idefics.py @@ -1,4 +1,5 @@ import pytest +import base64 @pytest.fixture(scope="module") @@ -15,10 +16,17 @@ async def idefics(idefics_handle): return idefics_handle.client +# TODO fix the server parsser to count inline image tokens correctly +def get_chicken(): + with open("integration-tests/images/chicken_on_money.png", "rb") as image_file: + encoded_string = base64.b64encode(image_file.read()) + return f"data:image/png;base64,{encoded_string}" + + @pytest.mark.asyncio async def test_idefics(idefics, response_snapshot): response = await idefics.generate( - "User:![](https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/6af279110440b7ba0c43f6a0be93b9926f062c42/example_images/chicken_on_money.png)Can you tell me a very short story based on the image?", + "User:![](https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/example_images/chicken_on_money.png?download=true)Can you tell me a very short story based on the image?", max_new_tokens=10, decoder_input_details=True, ) @@ -31,7 +39,7 @@ async def test_idefics(idefics, response_snapshot): async def test_idefics_load(idefics, generate_load, response_snapshot): responses = await generate_load( idefics, - "User:![](https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/6af279110440b7ba0c43f6a0be93b9926f062c42/example_images/chicken_on_money.png)Can you tell me a very short story based on the image?", + "User:![](https://huggingface.co/spaces/HuggingFaceM4/idefics_playground/resolve/main/example_images/chicken_on_money.png?download=true)Can you tell me a very short story based on the image?", max_new_tokens=10, n=4, )