mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-09-24 20:20:37 +00:00
fix: enable VAE decode tiling fallback without auto-fit (#1932)
This commit is contained in:
parent
14eddb32b1
commit
b68d58624d
@ -188,8 +188,9 @@ weights, compute buffers and caches must
|
|||||||
still fit the runner's capacity checks. Offloading weights does not guarantee
|
still fit the runner's capacity checks. Offloading weights does not guarantee
|
||||||
that every resolution or frame count will fit, and auto-fit does not change a
|
that every resolution or frame count will fit, and auto-fit does not change a
|
||||||
component to CPU computation solely because its full weights exceed VRAM.
|
component to CPU computation solely because its full weights exceed VRAM.
|
||||||
If a VAE decode fails, auto-fit retries with spatial tiling; supported video
|
If a VAE decode fails, decoding retries with spatial tiling even when `--auto-fit`
|
||||||
decoders try temporal tiling first and can then add spatial tiling.
|
is off; supported video decoders try temporal tiling first and can then add
|
||||||
|
spatial tiling. Spatial retries use half-size tiles along each latent dimension.
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
|
|||||||
@ -390,6 +390,8 @@ namespace sd::backend_fit {
|
|||||||
retry_mode = tiling_params.enabled ? "spatial+temporal" : "temporal";
|
retry_mode = tiling_params.enabled ? "spatial+temporal" : "temporal";
|
||||||
} else if (!tiling_params.enabled) {
|
} else if (!tiling_params.enabled) {
|
||||||
tiling_params.enabled = true;
|
tiling_params.enabled = true;
|
||||||
|
tiling_params.rel_size_x = 0.5f;
|
||||||
|
tiling_params.rel_size_y = 0.5f;
|
||||||
if (tiling_params.tile_size_x <= 0) {
|
if (tiling_params.tile_size_x <= 0) {
|
||||||
tiling_params.tile_size_x = 256;
|
tiling_params.tile_size_x = 256;
|
||||||
}
|
}
|
||||||
@ -401,7 +403,7 @@ namespace sd::backend_fit {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_WARN("auto-fit: VAE decode failed (likely out of memory); retrying with %s tiling",
|
LOG_WARN("VAE decode failed (likely out of memory); retrying with %s tiling",
|
||||||
retry_mode);
|
retry_mode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2621,7 +2621,6 @@ sd::Tensor<float> StableDiffusionGGML::decode_first_stage(const sd::Tensor<float
|
|||||||
auto decoded = first_stage_model->decode(n_threads, latents, vae_tiling_params, decode_video, circular_x, circular_y);
|
auto decoded = first_stage_model->decode(n_threads, latents, vae_tiling_params, decode_video, circular_x, circular_y);
|
||||||
const bool prefer_temporal_tiling = decode_video && first_stage_model->can_temporal_tile_decode();
|
const bool prefer_temporal_tiling = decode_video && first_stage_model->can_temporal_tile_decode();
|
||||||
while (decoded.empty() &&
|
while (decoded.empty() &&
|
||||||
auto_fit_enabled &&
|
|
||||||
sd::backend_fit::prepare_vae_decode_retry_tiling(vae_tiling_params, prefer_temporal_tiling)) {
|
sd::backend_fit::prepare_vae_decode_retry_tiling(vae_tiling_params, prefer_temporal_tiling)) {
|
||||||
decoded = first_stage_model->decode(n_threads, latents, vae_tiling_params, decode_video, circular_x, circular_y);
|
decoded = first_stage_model->decode(n_threads, latents, vae_tiling_params, decode_video, circular_x, circular_y);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user