-
Notifications
You must be signed in to change notification settings - Fork 6.7k
z-image support npu #12979
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
base: main
Are you sure you want to change the base?
z-image support npu #12979
Conversation
|
@yiyuxuxu Hello, could you please review this pr, thank you. |
|
@yiyixuxu @sayakpaul Hello, could you please review this pr, thank you. |
| return x | ||
|
|
||
|
|
||
| class RopeEmbedderNPU: |
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.
Is it not possible to modify the existing RopeEmbedder class to account for the NPU hardware?
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.
maybe we could modify the current RopeEmbedder class same as RopeEmbedderNPU?It could work for both device
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.
No I mean we keep the class name as RopeEmbedder and modify the definition such that it also works on NPU alongside current devices.
|
@sayakpaul I merged RopeEmbedderNPU into RopeEmbedder class, please review the modification |
What does this PR do?
Issue: The Diffusers Z-Image pipeline fails on Ascend NPU because aclnnIndex lacks support for complex64. When freqs_cis is stored as a complex tensor on the NPU and then indexed, the call crashes.
Fix: Rework the RoPE frequency handling so that the NPU never needs to index complex64 tensors.
Running Environment:
I run this model base on cache-dit(https://github.com/vipshop/cache-dit/) which depends on diffusers to inference.
Command:
python3 generate.py zimage --model-path /home/weights/Z-Image-Turbo --attn _native_npu
Error before fixed:

Result after fixed:

Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.