-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt for cleverer auto batch_prefill values (some simplifications). #2808
Merged
+337
−131
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
037ea55
Attempt for cleverer auto batch_prefill values (some simplifications).
Narsil a0003a6
Less flaky tests.
Narsil 5b04d6c
Fixing typo insertion.
Narsil 36ed43c
Update launcher/src/main.rs
Narsil d701f9e
Adding small comment for source of calculation.
Narsil 908dec6
Adding L40.
Narsil 14d1973
Adding L40s.
Narsil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,81 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def flash_qwen2_vl_handle(launcher): | ||
with launcher("Qwen/Qwen2-VL-7B-Instruct") as handle: | ||
yield handle | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
async def flash_qwen2(flash_qwen2_vl_handle): | ||
await flash_qwen2_vl_handle.health(300) | ||
return flash_qwen2_vl_handle.client | ||
|
||
|
||
@pytest.mark.private | ||
async def test_flash_qwen2_vl_simple(flash_qwen2, response_snapshot): | ||
response = await flash_qwen2.chat( | ||
max_tokens=100, | ||
seed=42, | ||
messages=[ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png" | ||
}, | ||
}, | ||
{"type": "text", "text": "Describe this image."}, | ||
], | ||
}, | ||
], | ||
) | ||
|
||
assert ( | ||
response.choices[0].message.content | ||
== "The image depicts an anthropomorphic rabbit, wearing a futuristic spacesuit, in an extraterrestrial environment. The setting appears to be a red planet resembling Mars, with rugged terrain and rocky formations in the background. The moon is visible in the distant sky, adding to the lunar landscape." | ||
) | ||
|
||
assert response == response_snapshot | ||
|
||
|
||
@pytest.mark.private | ||
async def test_flash_qwen2_vl_simple_streaming(flash_qwen2, response_snapshot): | ||
responses = await flash_qwen2.chat( | ||
max_tokens=100, | ||
seed=42, | ||
messages=[ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png" | ||
}, | ||
}, | ||
{"type": "text", "text": "Describe this image."}, | ||
], | ||
}, | ||
], | ||
stream=True, | ||
) | ||
|
||
count = 0 | ||
generated = "" | ||
last_response = None | ||
async for response in responses: | ||
count += 1 | ||
generated += response.choices[0].delta.content | ||
last_response = response | ||
|
||
assert ( | ||
generated | ||
== "The image depicts an anthropomorphic rabbit, wearing a futuristic spacesuit, in an extraterrestrial environment. The setting appears to be a red planet resembling Mars, with rugged terrain and rocky formations in the background. The moon is visible in the distant sky, adding to the lunar landscape." | ||
) | ||
assert count == 58 | ||
assert last_response == response_snapshot | ||
# Disabled because it's broken. | ||
# import pytest | ||
# | ||
# | ||
# @pytest.fixture(scope="module") | ||
# def flash_qwen2_vl_handle(launcher): | ||
# with launcher("Qwen/Qwen2-VL-7B-Instruct") as handle: | ||
# yield handle | ||
# | ||
# | ||
# @pytest.fixture(scope="module") | ||
# async def flash_qwen2(flash_qwen2_vl_handle): | ||
# await flash_qwen2_vl_handle.health(300) | ||
# return flash_qwen2_vl_handle.client | ||
# | ||
# | ||
# @pytest.mark.private | ||
# async def test_flash_qwen2_vl_simple(flash_qwen2, response_snapshot): | ||
# response = await flash_qwen2.chat( | ||
# max_tokens=100, | ||
# seed=42, | ||
# messages=[ | ||
# { | ||
# "role": "user", | ||
# "content": [ | ||
# { | ||
# "type": "image_url", | ||
# "image_url": { | ||
# "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png" | ||
# }, | ||
# }, | ||
# {"type": "text", "text": "Describe this image."}, | ||
# ], | ||
# }, | ||
# ], | ||
# ) | ||
# | ||
# assert ( | ||
# response.choices[0].message.content | ||
# == "The image depicts an anthropomorphic rabbit, wearing a futuristic spacesuit, in an extraterrestrial environment. The setting appears to be a red planet resembling Mars, with rugged terrain and rocky formations in the background. The moon is visible in the distant sky, adding to the lunar landscape." | ||
# ) | ||
# | ||
# assert response == response_snapshot | ||
# | ||
# | ||
# @pytest.mark.private | ||
# async def test_flash_qwen2_vl_simple_streaming(flash_qwen2, response_snapshot): | ||
# responses = await flash_qwen2.chat( | ||
# max_tokens=100, | ||
# seed=42, | ||
# messages=[ | ||
# { | ||
# "role": "user", | ||
# "content": [ | ||
# { | ||
# "type": "image_url", | ||
# "image_url": { | ||
# "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png" | ||
# }, | ||
# }, | ||
# {"type": "text", "text": "Describe this image."}, | ||
# ], | ||
# }, | ||
# ], | ||
# stream=True, | ||
# ) | ||
# | ||
# count = 0 | ||
# generated = "" | ||
# last_response = None | ||
# async for response in responses: | ||
# count += 1 | ||
# generated += response.choices[0].delta.content | ||
# last_response = response | ||
# | ||
# assert ( | ||
# generated | ||
# == "The image depicts an anthropomorphic rabbit, wearing a futuristic spacesuit, in an extraterrestrial environment. The setting appears to be a red planet resembling Mars, with rugged terrain and rocky formations in the background. The moon is visible in the distant sky, adding to the lunar landscape." | ||
# ) | ||
# assert count == 58 | ||
# assert last_response == response_snapshot |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing something. Can't this only be true when
sum(equals) == len(equals)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want the error message to be about the content and containing the diff.