Skip to content

Commit 1cbcca2

Browse files
stduhpfmadebyollin
andcommitted
fix permute ctx for videeo decoding
Co-authored-by: Ollin Boer Bohan <[email protected]>
1 parent 15bbdf4 commit 1cbcca2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

stable-diffusion.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,10 +2312,6 @@ class StableDiffusionGGML {
23122312
first_stage_model->free_compute_buffer();
23132313
process_vae_output_tensor(result);
23142314
} else {
2315-
if (sd_version_is_wan(version)) {
2316-
x = ggml_permute(work_ctx, x, 0, 1, 3, 2);
2317-
}
2318-
23192315
if (vae_tiling_params.enabled && !decode_video) {
23202316
// split latent in 64x64 tiles and compute in several steps
23212317
auto on_tiling = [&](ggml_tensor* in, ggml_tensor* out, bool init) {
@@ -2326,7 +2322,6 @@ class StableDiffusionGGML {
23262322
tae_first_stage->compute(n_threads, x, true, &result);
23272323
}
23282324
tae_first_stage->free_compute_buffer();
2329-
23302325
}
23312326

23322327
int64_t t1 = ggml_time_ms();

tae.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ class TAEHV : public GGMLBlock {
372372

373373
struct ggml_tensor* decode(GGMLRunnerContext* ctx, struct ggml_tensor* z) {
374374
auto decoder = std::dynamic_pointer_cast<TinyVideoDecoder>(blocks["decoder"]);
375+
if (sd_version_is_wan(version)) {
376+
// (W, H, C, T) -> (W, H, T, C)
377+
z = ggml_cont(ctx->ggml_ctx, ggml_permute(ctx->ggml_ctx, z, 0, 1, 3, 2));
378+
}
375379
auto result = decoder->forward(ctx, z);
376380
if (sd_version_is_wan(version)) {
377381
// (W, H, C, T) -> (W, H, T, C)

0 commit comments

Comments
 (0)