-
Notifications
You must be signed in to change notification settings - Fork 455
[Bugfix] Fix generation artifacts of Qwen-Image-Edit-2511 and update pipeline DiT param parsing #776
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
+89
−23
Merged
[Bugfix] Fix generation artifacts of Qwen-Image-Edit-2511 and update pipeline DiT param parsing #776
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
62545a2
default seed 0
SamitHuang d16303d
fix qwen image edit quality issue, improve qwen dit init args parsing
SamitHuang 1284136
use AdaLayerNorm for text emb
SamitHuang 32f5196
update tf parse utils
SamitHuang 8ac473c
rm comments
SamitHuang d23d0a9
add file
SamitHuang 487bc18
fix linting
SamitHuang dbe6ecb
fix doc
SamitHuang f308954
use AdaLayerNorm for image modulation
SamitHuang 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
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 |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import inspect | ||
hsliuustc0106 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from typing import Any | ||
|
|
||
| from vllm_omni.diffusion.data import TransformerConfig | ||
|
|
||
|
|
||
| def get_transformer_config_kwargs( | ||
| tf_model_config: TransformerConfig, model_class: type[Any] | None = None | ||
| ) -> dict[str, Any]: | ||
| """ | ||
| This function extracts parameters from a TransformerConfig instance and filters out internal | ||
| diffusers metadata keys (those starting with '_') that should not be passed to model initialization. | ||
| Also filters out parameters that are not accepted by the model's __init__ method (e.g., pooled_projection_dim | ||
| for QwenImageTransformer2DModel). | ||
|
|
||
| This uses inspect.signature to dynamically detect accepted parameters, making it general for any model class. | ||
| Similar to how diffusers' @register_to_config decorator works. | ||
|
|
||
| Args: | ||
| tf_model_config: TransformerConfig instance containing model parameters | ||
| model_class: Optional model class to inspect for accepted __init__ parameters. | ||
| If None, all non-internal parameters are returned (backward compatibility). | ||
|
|
||
| Returns: | ||
| dict: Filtered dictionary of parameters suitable for transformer model initialization | ||
| """ | ||
| # Extract transformer config parameters, filtering out internal diffusers metadata | ||
| # TransformerConfig stores params in a 'params' dict, and we need to exclude | ||
| # internal keys like '_class_name' and '_diffusers_version' | ||
| tf_config_params = tf_model_config.to_dict() | ||
|
|
||
| # Filter out internal diffusers metadata keys that start with '_' | ||
| filtered_params = {k: v for k, v in tf_config_params.items() if not k.startswith("_")} | ||
|
|
||
| # If model_class is provided, use inspect.signature to get accepted parameters | ||
| if model_class is not None: | ||
| try: | ||
| # Get the signature of the model's __init__ method | ||
| sig = inspect.signature(model_class.__init__) | ||
| # Get all parameter names (excluding 'self' and special parameters) | ||
| accepted_params = { | ||
| name | ||
| for name, param in sig.parameters.items() | ||
| if name != "self" and param.kind != inspect.Parameter.VAR_KEYWORD # Exclude **kwargs | ||
| } | ||
|
|
||
| # Filter to only include parameters that are in the model's signature | ||
| filtered_params = {k: v for k, v in filtered_params.items() if k in accepted_params} | ||
| except (TypeError, AttributeError): | ||
| # If inspection fails, fall back to returning all non-internal params | ||
| # This maintains backward compatibility | ||
| pass | ||
|
|
||
| return filtered_params | ||
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.
Uh oh!
There was an error while loading. Please reload this page.