@@ -3455,7 +3455,9 @@ class StableDiffusionGGML {
3455
3455
struct ggml_tensor * out = diffusion_model.forward (ctx, noised_input, NULL , context, t_emb);
3456
3456
ggml_hold_dynamic_tensor (out);
3457
3457
3458
- struct ggml_cgraph * diffusion_graph = ggml_build_forward_ctx (ctx, out);
3458
+ struct ggml_cgraph * diffusion_graph = ggml_new_graph (ctx);
3459
+ diffusion_graph->order = GGML_CGRAPH_EVAL_ORDER_RIGHT_TO_LEFT;
3460
+ ggml_build_forward_expand (diffusion_graph, out);
3459
3461
cplan = ggml_graph_plan (diffusion_graph, n_threads);
3460
3462
3461
3463
ggml_set_dynamic (ctx, false );
@@ -4012,7 +4014,10 @@ class StableDiffusionGGML {
4012
4014
}
4013
4015
4014
4016
struct ggml_tensor * moments = first_stage_model.encode (ctx, x);
4015
- struct ggml_cgraph * vae_graph = ggml_build_forward_ctx (ctx, moments);
4017
+
4018
+ struct ggml_cgraph * vae_graph = ggml_new_graph (ctx);
4019
+ vae_graph->order = GGML_CGRAPH_EVAL_ORDER_RIGHT_TO_LEFT;
4020
+ ggml_build_forward_expand (vae_graph, moments);
4016
4021
4017
4022
int64_t t0 = ggml_time_ms ();
4018
4023
ggml_graph_compute_with_ctx (ctx, vae_graph, n_threads);
@@ -4142,7 +4147,10 @@ class StableDiffusionGGML {
4142
4147
}
4143
4148
4144
4149
struct ggml_tensor * img = first_stage_model.decode (ctx, z);
4145
- struct ggml_cgraph * vae_graph = ggml_build_forward_ctx (ctx, img);
4150
+
4151
+ struct ggml_cgraph * vae_graph = ggml_new_graph (ctx);
4152
+ vae_graph->order = GGML_CGRAPH_EVAL_ORDER_RIGHT_TO_LEFT;
4153
+ ggml_build_forward_expand (vae_graph, img);
4146
4154
4147
4155
int64_t t0 = ggml_time_ms ();
4148
4156
ggml_graph_compute_with_ctx (ctx, vae_graph, n_threads);
0 commit comments