modelscope / modelscope/DiffSynth-Studio

Is prompt_emb[:, v:] = 0 intentional or a mistake?

Open
#561 0 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

Hi, I found this line in the encode_prompt function in diffsynth/prompters/wan_prompter.py:

for i, v in enumerate(seq_lens):
    prompt_emb[:, v:] = 0

I'm wondering if this line is intentionally written like this — applying zeroing across the entire batch from position v — or if it was meant to be:

prompt_emb[i, v:] = 0

to zero out only the padding part of each individual sample.

Would appreciate any clarification. Thanks!

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

Read encode_prompt in diffsynth/prompters/wan_prompter.py and trace how seq_lens and prompt_emb represent batched prompts. Determine whether zeroing should apply per sample or across the batch. Done means resolving the intent and documenting or correcting the behavior with coverage for batched padding.

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.