bring back freeing pmid lora params buffer; simply pooled output of CLIPvision

This commit is contained in:
bssrdf committed 2024-02-27 14:49:39 -05:00
1 parent 60796158b1
commit fd098afc6d
2 files changed
+10 -10

No files matched your search

+4 -4
View File
@@ -904,10 +904,10 @@ public:
GGML_ASSERT(x->ne[3] == 1); GGML_ASSERT(x->ne[3] == 1);
// int64_t max_token_idx = 0; // int64_t max_token_idx = 0;
// ggml_tensor* pooled = ggml_view_1d(ctx, x, x->ne[0], x->nb[1] * max_token_idx); // assert N == 1 // ggml_tensor* pooled = ggml_view_1d(ctx, x, x->ne[0], x->nb[1] * max_token_idx); // assert N == 1
x = ggml_cont(ctx, ggml_permute(ctx, x, 0, 2, 1, 3)); // x = ggml_cont(ctx, ggml_permute(ctx, x, 0, 2, 1, 3));
ggml_tensor* pooled = ggml_view_2d(ctx, x, x->ne[0], x->ne[1], x->nb[0], 0); // ggml_tensor* pooled = ggml_view_2d(ctx, x, x->ne[0], x->ne[1], x->nb[0], 0);
pooled = ggml_scale(ctx, ggml_cont(ctx, pooled), 1.f); // pooled = ggml_cont(ctx, pooled);
// print_ggml_tensor(pooled, true, "pooled"); ggml_tensor* pooled = ggml_cont(ctx, ggml_view_2d(ctx, x, x->ne[0], x->ne[2], x->nb[2], 0));
return pooled; // [N, projection_dim] return pooled; // [N, projection_dim]
} }
+6 -6
View File
@@ -1641,13 +1641,13 @@ sd_image_t* txt2img(sd_ctx_t* sd_ctx,
LOG_INFO("apply_loras completed, taking %.2fs", (t1 - t0) * 1.0f / 1000); LOG_INFO("apply_loras completed, taking %.2fs", (t1 - t0) * 1.0f / 1000);
if(sd_ctx->sd->stacked_id){ if(sd_ctx->sd->stacked_id){
// sd_ctx->sd->pmid_lora.apply(sd_ctx->sd->tensors, sd_ctx->sd->n_threads); t0 = ggml_time_ms();
sd_ctx->sd->pmid_lora->apply(sd_ctx->sd->tensors, sd_ctx->sd->n_threads); sd_ctx->sd->pmid_lora->apply(sd_ctx->sd->tensors, sd_ctx->sd->n_threads);
// sd_ctx->sd->pmid_lora.free_compute_buffer(); t1 = ggml_time_ms();
// if (sd_ctx->sd->free_params_immediately) { LOG_INFO("pmid_lora apply completed, taking %.2fs", (t1 - t0) * 1.0f / 1000);
// sd_ctx->sd->pmid_lora.free_params_buffer(); if (sd_ctx->sd->free_params_immediately) {
// } sd_ctx->sd->pmid_lora->free_params_buffer();
LOG_INFO("pmid_lora apply completed"); }
} }
struct ggml_init_params params; struct ggml_init_params params;