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

This commit is contained in:
bssrdf
2024-02-27 14:49:39 -05:00
parent 60796158b1
commit fd098afc6d
2 changed files with 10 additions and 10 deletions

View File

@@ -904,10 +904,10 @@ public:
GGML_ASSERT(x->ne[3] == 1);
// 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
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);
pooled = ggml_scale(ctx, ggml_cont(ctx, pooled), 1.f);
// print_ggml_tensor(pooled, true, "pooled");
// 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);
// pooled = ggml_cont(ctx, 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]
}

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);
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.free_compute_buffer();
// if (sd_ctx->sd->free_params_immediately) {
// sd_ctx->sd->pmid_lora.free_params_buffer();
// }
LOG_INFO("pmid_lora apply completed");
t1 = ggml_time_ms();
LOG_INFO("pmid_lora apply completed, taking %.2fs", (t1 - t0) * 1.0f / 1000);
if (sd_ctx->sd->free_params_immediately) {
sd_ctx->sd->pmid_lora->free_params_buffer();
}
}
struct ggml_init_params params;