huggingface / huggingface/diffusers

Wan I2V expand_timesteps: why hard-clamp only first frame (no last-frame clamp)?

Đang mở
#13,167 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
34.5k
Fork
7.3k
Merge trung bình
3 ngày 3 giờ
Pull request đã merge (30 ngày)
91

Mô tả

I have a question on `expand_timesteps` option within `WanImageToVideoPipeline`. I see that the mechanism hard-clamps only the first frame. For FLF (first+last) conditioning, is there a reason we can’t (or shouldn’t) apply the same mechanism to *both* endpoints?

The related code is in:
- `diffusers/src/diffusers/pipelines/wan/pipeline_wan_i2v.py`

In `prepare_latents`, when `expand_timesteps` is enabled, `video_condition` ignores `last_image` and `first_frame_mask` is defined only for frame 0:
```py
# prepare_latents
if self.config.expand_timesteps:
video_condition = image

...
if self.config.expand_timesteps:
first_frame_mask = torch.ones(1, 1, num_latent_frames, latent_height, latent_width, ...)
first_frame_mask[:, :, 0] = 0
return latents, latent_condition, first_frame_mask
```
In the denoising loop, the clamp/mix uses only first_frame_mask:

```py

if self.config.expand_timesteps:
latent_model_input = (1 - first_frame_mask) * condition + first_frame_mask * latents
temp_ts = (first_frame_mask[0][0][:, ::2, ::2] * t).flatten()
```

Question
Is it a limitation of the Wan2.2 I2V checkpoint training (only first-frame conditioning)?
Or a design choice because per-token timestep masking doesn’t extend cleanly to a last-frame constraint?

I see that the corresponding part was written by @yiyixuxu, thanks!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start in diffusers/src/diffusers/pipelines/wan/pipeline_wan_i2v.py and trace prepare_latents, first_frame_mask, and the denoising-loop clamp/mix. Check whether Wan2.2 I2V training supports last-frame conditioning or whether timestep masking prevents it; done means documenting the reason or defining the required behavior for both endpoints.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python, pytorch
Lĩnh vực
machine-learning
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.