mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 19:36:33 +00:00
fix: keep MiniMax-H3 VAE weights resident across temporal chunks (#2103)
This commit is contained in:
1 parent
1da55ebde8
commit
0963357214
2 files changed
+35
-4
No files matched your search
@@ -633,8 +633,11 @@ namespace MiniMaxH3VAE {
|
||||
auto plan = make_vae_temporal_tile_plan(input.shape()[2], {17, 0});
|
||||
auto result = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& chunk, const VAETemporalTile& tile) {
|
||||
SD_UNUSED(tile);
|
||||
return VAE::encode(n_threads, chunk, tiling, circular_x, circular_y);
|
||||
// keep the runner alive across chunks; ending it here would
|
||||
// evict and reload the encoder weights every chunk
|
||||
return VAE::encode(n_threads, chunk, tiling, circular_x, circular_y, false);
|
||||
});
|
||||
runner_end();
|
||||
if (result.empty()) {
|
||||
return {};
|
||||
}
|
||||
@@ -695,13 +698,16 @@ namespace MiniMaxH3VAE {
|
||||
{static_cast<int>(tokens_per_chunk + token_overlap), static_cast<int>(token_overlap)});
|
||||
GGML_ASSERT(plan.tiles.size() == static_cast<size_t>(num_chunks));
|
||||
auto result = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& chunk, const VAETemporalTile& tile) {
|
||||
// keep the runner alive across chunks; ending it here would
|
||||
// evict and reload the decoder weights every chunk
|
||||
auto decoded = VAE::decode(n_threads,
|
||||
chunk,
|
||||
tiling,
|
||||
true,
|
||||
circular_x,
|
||||
circular_y,
|
||||
silent);
|
||||
silent,
|
||||
false);
|
||||
if (decoded.empty()) {
|
||||
return sd::Tensor<float>();
|
||||
}
|
||||
@@ -728,6 +734,7 @@ namespace MiniMaxH3VAE {
|
||||
}
|
||||
return first;
|
||||
});
|
||||
runner_end();
|
||||
if (result.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user