-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[BugFix]: Fix multi-stage cfg bug #2801
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
Merged
princepride
merged 9 commits into
vllm-project:main
from
princepride:fix-multi-stage-cfg-bug
Apr 18, 2026
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
28b5555
fix multi-stage cfg bug
princepride f1b230e
update ut
princepride a88efd0
fix some bug
princepride 0e33ff4
fix some bug
princepride 6a2748e
fix some bug
princepride 82164e9
Merge branch 'main' into fix-multi-stage-cfg-bug
princepride 703dbb3
Update pipeline_bagel.py
princepride ffa5926
Correct indentation for else statement
princepride d21b349
update
princepride 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
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
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
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 |
|---|---|---|
|
|
@@ -82,6 +82,8 @@ def expand_cfg_prompts( | |
| neg_prompt = _get_negative_prompt(prompt, sampling_params) | ||
|
|
||
| if "image" in modalities: | ||
| if not neg_prompt: | ||
| return [] | ||
| neg_prompt_dict = { | ||
| "prompt": neg_prompt, | ||
| "modalities": prompt.get("modalities", []), | ||
|
|
@@ -166,6 +168,8 @@ def expand_cfg_prompts_think( | |
| companion_params = {"max_tokens": 1} | ||
|
|
||
| if "image" in modalities: | ||
| if not neg_prompt: | ||
| return [] | ||
| neg_prompt_dict = { | ||
| "prompt": neg_prompt, | ||
| "modalities": prompt.get("modalities", []), | ||
|
|
@@ -300,4 +304,4 @@ def _get_negative_prompt( | |
| if neg: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docstring above (line 293-296) is stale — still says "falls through to the Bagel default token pair" but we now return |
||
| return neg | ||
|
|
||
| return "<|im_start|><|im_end|>" | ||
| return "" | ||
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.
With the
else,cfg_img_kv = injected_kvis dead —cfg_img_kvisn't read after this block. Was the intent to also populatecfg_img_contextwithinjected_kvwhen it's None? The single-stage path populates cfg_img_context with the positive prompt KV viaforward_cache_update_text, and for text2img multi-stageinjected_kvis the equivalent. If leaving cfg_img_context empty here is intentional, drop the assignment.