Skip to content

Commit a8b8c78

Browse files
committed
Fix negative prompt embedding
1 parent 6599352 commit a8b8c78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fastvideo/pipelines/stages/text_encoding.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ def forward(
116116
with open("/workspace/FastVideo/fastvideo_hidden_states.log", "a") as f:
117117
f.write(f"TextEncodingStage: negative_prompt_embeds sum = {sum_value:.6f}\n")
118118

119+
# Apply attention mask length processing (like Diffusers does)
120+
lengths = negative_attention_mask.sum(dim=1).cpu()
121+
for i, length in enumerate(lengths):
122+
negative_prompt_embeds[i, length:] = 0
123+
124+
sum_value = negative_prompt_embeds.float().sum().item()
125+
logger.info(f"TextEncodingStage: negative_prompt_embeds sum after masking = {sum_value:.6f}")
126+
with open("/workspace/FastVideo/fastvideo_hidden_states.log", "a") as f:
127+
f.write(f"TextEncodingStage: negative_prompt_embeds sum after masking = {sum_value:.6f}\n")
128+
119129
assert batch.negative_prompt_embeds is not None
120130
batch.negative_prompt_embeds.append(negative_prompt_embeds)
121131
if batch.negative_attention_mask is not None:

0 commit comments

Comments
 (0)