Skip to content

Commit a1a62a3

Browse files
idostyleido
authored and
ido
committed
cond cache *1
1 parent 22d2818 commit a1a62a3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

stable-diffusion.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,22 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx,
13451345
height,
13461346
sd_ctx->sd->diffusion_model->get_adm_in_channels());
13471347

1348+
const char * cond_fname = "cond.gguf";
1349+
struct gguf_context * cond_ctx = gguf_init_empty();
1350+
1351+
if (cond.c_crossattn != NULL) {
1352+
gguf_add_tensor(cond_ctx, cond.c_crossattn);
1353+
}
1354+
if (cond.c_vector != NULL) {
1355+
gguf_add_tensor(cond_ctx, cond.c_vector);
1356+
}
1357+
if (cond.c_concat != NULL) {
1358+
gguf_add_tensor(cond_ctx, cond.c_concat);
1359+
}
1360+
1361+
gguf_write_to_file(cond_ctx, cond_fname);
1362+
gguf_free(cond_ctx);
1363+
13481364
SDCondition uncond;
13491365
if (cfg_scale != 1.0) {
13501366
bool force_zero_embeddings = false;

0 commit comments

Comments
 (0)