fix: balance singleton tails in short Wan vae decode plans (#2197)

This commit is contained in:
losewayy
2026-10-25 03:06:58 +08:00
committed by GitHub
parent 50a64f075e
commit 4c870cc60c
+10
View File
@@ -1498,6 +1498,16 @@ namespace WAN {
stateful_config.overlap = 0;
auto plan = make_vae_temporal_tile_plan(input.shape()[2], stateful_config);
if (sd_version_is_wan(version) && !ae.is_2D && plan.tiles.size() > 1 &&
plan.tiles.size() <= 3 && plan.tile_frames > 2 &&
plan.tiles.back().end - plan.tiles.back().start == 1) {
// Longer plans retain full middle tiles, so balancing their tail cannot shrink the largest decoded output.
auto& previous = plan.tiles[plan.tiles.size() - 2];
auto& last = plan.tiles.back();
--previous.end;
--last.start;
}
LOG_VERBOSE("Wan VAE stateful temporal tiling: tile_frames=%d, decode_frames=%d, total latent frames=%lld, tiles=%d",
plan.tile_frames,
version == VERSION_WAN2_2_TI2V && !ae.is_2D ? config.decode_frames : 1,