Skip to content

Commit

Permalink
sampling : fix malloc
Browse files Browse the repository at this point in the history
ggml-alloc
  • Loading branch information
ggerganov committed Oct 15, 2023
1 parent 0d96efa commit 0620ee7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions common/sampling.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "sampling.h"

struct llama_sampling_context * llama_sampling_init(const struct gpt_params & params) {
struct llama_sampling_context * result =
(struct llama_sampling_context *) malloc(sizeof(struct llama_sampling_context));
struct llama_sampling_context * result = new llama_sampling_context();

result->params = params.sampling_params;
result->grammar = nullptr;
Expand Down Expand Up @@ -34,7 +33,7 @@ void llama_sampling_free(struct llama_sampling_context * ctx) {
llama_grammar_free(ctx->grammar);
}

free(ctx);
delete ctx;
}

void llama_sampling_reset(llama_sampling_context * ctx) {
Expand Down

0 comments on commit 0620ee7

Please sign in to comment.