modelscope / modelscope/DiffSynth-Studio

Qwen-Image long prompt will cause error

Open
#753 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.1k
Forks
1.3k
Avg merge
13h 12m
Merged PRs (30d)
45

Description

When the token length is greater than 1024, it will be truncated to 1024. However, the length of RoPE is fixed at 1024 because the image takes up 32 len (for a 1024 width and height image). This causes the length of txt_freqs to be less than 1024. Therefore, x_rotated * freqs_cis will generate an error due to dimension mismatch.

RuntimeError: The size of tensor a (1024) must match the size of tensor b (983) at non-singleton dimension 2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Qwen-Image failure with a prompt longer than 1024 tokens and trace the code that truncates tokens and constructs RoPE or txt_freqs. Confirm the tensor dimensions at the x_rotated * freqs_cis operation; done means long prompts no longer produce the reported dimension-mismatch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.