mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-06-10 00:06:38 +00:00
fix: zero Wan2.2 TI2V timesteps for fixed frames (#1604)
This commit is contained in:
parent
a7f2e03da4
commit
1f9ee88e09
@ -1680,12 +1680,15 @@ public:
|
|||||||
const sd::Tensor<float>& init_latent,
|
const sd::Tensor<float>& init_latent,
|
||||||
const sd::Tensor<float>& denoise_mask) {
|
const sd::Tensor<float>& denoise_mask) {
|
||||||
if (diffusion_model->get_desc() == "Wan2.2-TI2V-5B") {
|
if (diffusion_model->get_desc() == "Wan2.2-TI2V-5B") {
|
||||||
auto new_timesteps = std::vector<float>(static_cast<size_t>(init_latent.shape()[2]), timesteps[0]);
|
int64_t frame_count = init_latent.shape()[2];
|
||||||
|
auto new_timesteps = std::vector<float>(static_cast<size_t>(frame_count), timesteps[0]);
|
||||||
|
|
||||||
if (!denoise_mask.empty()) {
|
if (!denoise_mask.empty() && denoise_mask.dim() >= 4 && denoise_mask.shape()[2] == frame_count) {
|
||||||
float value = denoise_mask.dim() == 5 ? denoise_mask.index(0, 0, 0, 0, 0) : denoise_mask.index(0, 0, 0, 0);
|
for (int64_t frame = 0; frame < frame_count; ++frame) {
|
||||||
if (value == 0.f) {
|
float value = denoise_mask.dim() == 5 ? denoise_mask.index(0, 0, frame, 0, 0) : denoise_mask.index(0, 0, frame, 0);
|
||||||
new_timesteps[0] = 0.f;
|
if (value == 0.f) {
|
||||||
|
new_timesteps[static_cast<size_t>(frame)] = 0.f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new_timesteps;
|
return new_timesteps;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user