sampling : fix malloc

ggml-ci
This commit is contained in:
Georgi Gerganov 2023-10-16 00:09:24 +03:00
parent 0d96efabb5
commit b5554b9e05
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -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;
@ -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) {