mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-19 22:02:06 +00:00
* feat: expand vlm support and add image token logic and tests * fix: avoid unused perceiver config * feat: integrate image tokens into inputs embeds * feat: add simple idefics3 test * feat: update docs, image token logic and weight names * fix: improve image processing * feat: improve prefix for idefics3 * fix: bump idefics3 tests and snapshots * fix: improve text model loading * feat: consolidate changes with existing vlms and add support and test for smolvlm * fix: create new idefic3 file, simplify logic and adjust llama weight loading * fix: lint with ruff * fix: clean up idefics 3 and improve prefix handling * fix: improve typing * fix: improve prompt_split_image with ref to original impl * fix: adjust ruff lints and small refactors * fix: adjust FlashLlamaModel prefix logic
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import pytest
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def flash_smolvlm_next_handle(launcher):
|
|
with launcher("HuggingFaceTB/SmolVLM-Instruct") as handle:
|
|
yield handle
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
async def flash_smolvlm_next(flash_smolvlm_next_handle):
|
|
await flash_smolvlm_next_handle.health(300)
|
|
return flash_smolvlm_next_handle.client
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
@pytest.mark.private
|
|
async def test_flash_smolvlm_next_simple_url(flash_smolvlm_next, response_snapshot):
|
|
ny_skyline = "https://huggingface.co/spaces/merve/chameleon-7b/resolve/main/bee.jpg"
|
|
query = "What is in this image?"
|
|
response = await flash_smolvlm_next.generate(
|
|
f"<|begin_of_text|><|begin_of_text|>User:{query}<end_of_utterance>\nAssistant:",
|
|
max_new_tokens=10,
|
|
seed=1337,
|
|
)
|
|
print(response)
|
|
assert (
|
|
response.generated_text == " A bee on a pink flower."
|
|
), f"{repr(response.generated_text)}"
|
|
assert response.details.generated_tokens == 8
|
|
assert response == response_snapshot
|