Skip to content

Reduce memory usage during Whisper inference #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ggml : reuse ggml_new_i32
  • Loading branch information
ggerganov committed Feb 4, 2023
commit d922aa4aefefcea6931e3bce3ea2564fb85a2081
10 changes: 1 addition & 9 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -3016,15 +3016,7 @@ struct ggml_tensor * ggml_diag_mask_inf(
// TODO: when implement backward, fix this:
//struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
struct ggml_tensor * result = ggml_view_tensor(ctx, a);

// TODO: FIX ME !!!!!!!!!!!!!!!!!!!!!!!!
void * tmp = ctx->scratch.data;
ctx->scratch.data = NULL;

struct ggml_tensor * b = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 1);
((int32_t *) b->data)[0] = n_past;

ctx->scratch.data = tmp;
struct ggml_tensor * b = ggml_new_i32(ctx, n_past);

result->op = GGML_OP_DIAG_MASK_INF;
result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
Expand Down