-
Notifications
You must be signed in to change notification settings - Fork 1k
[CI] GLM-Image testcases #2167
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
Open
chickeyton
wants to merge
43
commits into
vllm-project:main
Choose a base branch
from
chickeyton:glm-image-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−0
Open
[CI] GLM-Image testcases #2167
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
c13040e
add test_glm_image_expansion.py
chickeyton 20f515b
enhancement
chickeyton 8914d7c
add --stage-configs-path
chickeyton 714b69d
add --stage-configs-path
chickeyton 2c630c1
enhancement
chickeyton 0cba929
bugfix
chickeyton b97cae5
bugfix
chickeyton bb829e8
bugfix
chickeyton 67c3d94
fix code check issues
chickeyton 0cae2da
fix code check issues
chickeyton de68a4d
fix code check issues
chickeyton 398410d
fix code check issues
chickeyton 8cf627e
fix code check issues
chickeyton 027c091
update comments
chickeyton 0c2b2f2
update comments
chickeyton 062434e
fix codecheck comments
chickeyton f4f9f16
Merge branch 'main' into glm-image-tests
chickeyton 1a15a18
fix codecheck issues
chickeyton a443e3c
Merge branch 'glm-image-tests' of https://github.com/chickeyton/vllm-…
chickeyton 237ce7a
Merge branch 'main' into glm-image-tests
Gaohan123 1598a9a
Merge branch 'main' into glm-image-tests
wtomin 64323e5
reslove conflicts
chickeyton a86a9a2
update import path
chickeyton 2f2fbec
update import path
chickeyton 3ded31e
update import path
chickeyton 9c47afd
bug fix
chickeyton ade07be
enhancement
chickeyton f1f2eaf
Merge branch 'main' into glm-image-tests
chickeyton aa17f9b
Merge branch 'main' into glm-image-tests
Gaohan123 904a0c7
bugfix
chickeyton 9134fb9
Merge branch 'glm-image-tests' of https://github.com/chickeyton/vllm-…
chickeyton b845ea5
bugfix
chickeyton 607f930
bugfix
chickeyton 32a13f8
bugfix
chickeyton dbaaa16
Merge branch 'main' into glm-image-tests
chickeyton 493271a
change to full_model
chickeyton 71f49da
print vllm ver in CI
chickeyton 8329b4f
Merge branch 'main' into glm-image-tests
chickeyton 81a53d0
save input output images
chickeyton 492d979
Merge branch 'glm-image-tests' of https://github.com/chickeyton/vllm-…
chickeyton 058b985
Merge branch 'main' into glm-image-tests
chickeyton 2a5dc93
Merge branch 'main' into glm-image-tests
hsliuustc0106 6c59c9e
Merge branch 'main' into glm-image-tests
congw729 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| """ | ||
| Comprehensive tests of diffusion features that are available in online serving mode | ||
| and are supported by the following models: | ||
| - GLM-Image: single image & text input | ||
| CFG-Parallel and Tensor-Parallel features are covered | ||
| """ | ||
|
|
||
| import random | ||
| import shutil | ||
|
|
||
| import pytest | ||
|
|
||
| from tests.helpers.mark import hardware_marks | ||
| from tests.helpers.media import generate_synthetic_image | ||
| from tests.helpers.runtime import ( | ||
| OmniServer, | ||
| OmniServerParams, | ||
| OpenAIClientHandler, | ||
| dummy_messages_from_mix_data, | ||
| ) | ||
|
|
||
| EDIT_PROMPT = "Transform this modern, geometrist image into a Vincent van Gogh style impressionist painting." | ||
| SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}) | ||
| PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2) | ||
|
|
||
|
|
||
| # This test file targets two models, so I write a helper function. | ||
| # If a similar test only involves one model, one can just define a global list variable. | ||
| def _get_diffusion_feature_cases(model: str): | ||
| return [ | ||
| pytest.param( | ||
| OmniServerParams( | ||
| model=model, | ||
| server_args=[], | ||
| ), | ||
| id="basic_001", | ||
| marks=SINGLE_CARD_FEATURE_MARKS, | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| @pytest.mark.full_model | ||
| @pytest.mark.diffusion | ||
| @pytest.mark.parametrize( | ||
| "omni_server", | ||
| _get_diffusion_feature_cases("zai-org/GLM-Image"), | ||
| indirect=True, | ||
| ) | ||
| def test_glm_image(omni_server: OmniServer, openai_client: OpenAIClientHandler): | ||
| """Test all diffusion features with GLM-Image in regular end-user scenarios.""" | ||
| image_size = 1024 | ||
| synthetic_image = generate_synthetic_image(image_size, image_size) | ||
| image_data_url = f"data:image/jpeg;base64,{synthetic_image['base64']}" | ||
|
|
||
| messages = dummy_messages_from_mix_data(image_data_url=image_data_url, content_text=EDIT_PROMPT) | ||
|
|
||
| # CFG parallel is only activated when a negative prompt and true_cfg_scale > 1.0 are both present | ||
| request_config = { | ||
| "model": omni_server.model, | ||
| "messages": messages, | ||
| "extra_body": { | ||
| "height": image_size, | ||
| "width": image_size, | ||
| "num_inference_steps": 2, | ||
| "guidance_scale": 1.5, | ||
| "true_cfg_scale": 4.0, | ||
| "seed": 42, | ||
| }, | ||
| } | ||
|
|
||
| responses = openai_client.send_diffusion_request(request_config) | ||
|
|
||
| pair_id = random.randint(10**8, 10**9 - 1) | ||
| shutil.copyfile(synthetic_image["file_path"], f"in_{pair_id}.jpg") | ||
| for response in responses: | ||
| for i, image in enumerate(response.images) or (): | ||
| image.convert("RGB").save(f"out_{pair_id}_{i}.jpg", format="JPEG") | ||
This file contains hidden or 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
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.
Currently, this test is not selected by any step in test-nightly.yml. Considering adding this test at the step Diffusion X2I(&A&T) · Function Test with H100 · Single-GPU ?