Skip to content

Add Qwen-Image#2348

Merged
regisss merged 1 commit intohuggingface:mainfrom
atakaha:qwen-image
Dec 15, 2025
Merged

Add Qwen-Image#2348
regisss merged 1 commit intohuggingface:mainfrom
atakaha:qwen-image

Conversation

@atakaha
Copy link
Contributor

@atakaha atakaha commented Nov 24, 2025

Enable qwen-image with Gaudi specific optimization. Rewrite RoPE from complex to cos/sin.

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@atakaha atakaha requested a review from regisss as a code owner November 24, 2025 21:49
Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Can you add a new entry for this model in the tables here and there please?

Can you also add some tests? Those can be directly taken and adapted from Diffusers.

Ccing @dsocek too

@dsocek
Copy link
Contributor

dsocek commented Dec 2, 2025

@atakaha looks quite good to me, I agree with @regisss please update high level docs too add CI tests from diffusers and possibly 1 slow test (for inference regressions check)

@atakaha atakaha force-pushed the qwen-image branch 4 times, most recently from 38ad113 to 5d1a70d Compare December 8, 2025 23:31
@atakaha
Copy link
Contributor Author

atakaha commented Dec 8, 2025

observing regression after rebase. Need to fix the regression.

@atakaha atakaha marked this pull request as draft December 9, 2025 02:27
@atakaha atakaha marked this pull request as ready for review December 9, 2025 17:05
@atakaha
Copy link
Contributor Author

atakaha commented Dec 9, 2025

@regisss and @dsocek please review this PR

  • Update required files.
  • Add slow pytest and confirmed it pass
  • rebased and fixed conflicts
  • confirmed both lazy and eager mode outputs.

Copy link
Contributor

@dsocek dsocek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, small fix suggested to add HPU centric example doc string

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do this monkey patching directly in the __init__ of the GaudiDiffusionPipeline?

# Patch for unconditional image generation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added like below, but didn't work.
from ..models.transformers import ( GaudiQwenTimestepProjEmbeddings, GaudiQwenEmbedRope, GaudiQwenDoubleStreamAttnProcessor2_0 ) diffusers.models.transformers.transformer_qwenimage.QwenTimestepProjEmbeddings = GaudiQwenTimestepProjEmbeddings diffusers.models.transformers.transformer_qwenimage.QwenEmbedRope = GaudiQwenEmbedRope diffusers.models.transformers.transformer_qwenimage.QwenDoubleStreamAttnProcessor2_0 = GaudiQwenDoubleStreamAttnProcessor2_0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

monkey patch doesn't work in __init__ but from_pretrained() of the GaudiDiffusionPipeline. Placed it in from_pretrained().

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for looking further into it!

@atakaha atakaha force-pushed the qwen-image branch 3 times, most recently from 4a1a5be to b0a635d Compare December 11, 2025 22:48
@atakaha atakaha requested review from dsocek and regisss December 11, 2025 22:59
@github-actions
Copy link

The code quality check failed, please run make style.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one more comment to basically move all the logic in modeling_utils.py to the from_pretrained method.

Also, the code style check failed, please run

make style

from the root of the repo.

Enable qwen-image with Gaudi specific optimization.
Rewrite RoPE from complex to cos/sin.
Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@regisss regisss merged commit e01a919 into huggingface:main Dec 15, 2025
2 of 4 checks passed
astachowiczhabana pushed a commit that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants