mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 12:24:53 +00:00
Repair idefics integration tests.
This commit is contained in:
parent
de6cb15fa5
commit
12fac2e03f
@ -1,4 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
@ -14,11 +15,17 @@ async def idefics(idefics_handle):
|
|||||||
await idefics_handle.health(300)
|
await idefics_handle.health(300)
|
||||||
return idefics_handle.client
|
return idefics_handle.client
|
||||||
|
|
||||||
|
def get_chicken():
|
||||||
|
with open("integrations-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
|
@pytest.mark.asyncio
|
||||||
async def test_idefics(idefics, response_snapshot):
|
async def test_idefics(idefics, response_snapshot):
|
||||||
|
chicken = get_chicken()
|
||||||
response = await idefics.generate(
|
response = await idefics.generate(
|
||||||
"User:Can you tell me a very short story based on the image?",
|
f"User:Can you tell me a very short story based on the image?",
|
||||||
max_new_tokens=10,
|
max_new_tokens=10,
|
||||||
decoder_input_details=True,
|
decoder_input_details=True,
|
||||||
)
|
)
|
||||||
@ -31,7 +38,7 @@ async def test_idefics(idefics, response_snapshot):
|
|||||||
async def test_idefics_load(idefics, generate_load, response_snapshot):
|
async def test_idefics_load(idefics, generate_load, response_snapshot):
|
||||||
responses = await generate_load(
|
responses = await generate_load(
|
||||||
idefics,
|
idefics,
|
||||||
"User:Can you tell me a very short story based on the image?",
|
f"User:Can you tell me a very short story based on the image?",
|
||||||
max_new_tokens=10,
|
max_new_tokens=10,
|
||||||
n=4,
|
n=4,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user