From 8795d1d8f66a7fff67d558dac41d259f75e87a46 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 26 Jul 2024 21:14:57 +0300 Subject: [PATCH] fix build ggml-ci --- src/llama-grammar.cpp | 1 + src/llama-sampling.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/llama-grammar.cpp b/src/llama-grammar.cpp index d5d4ceaa1ab171..c317154347e571 100644 --- a/src/llama-grammar.cpp +++ b/src/llama-grammar.cpp @@ -4,6 +4,7 @@ #include "llama-sampling.h" #include +#include // // helpers diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index b5815e4db295b8..bf2e88e71def19 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -48,7 +48,13 @@ void llama_sampling_free_impl(struct llama_sampling * sampling) { } struct llama_sampling * llama_sampling_cp_impl(const struct llama_sampling & smpl) { - GGML_ASSERT(false); // Not implemented + auto * result = new llama_sampling(smpl.n_vocab); + + if (smpl.grammar) { + result->grammar = llama_grammar_copy_impl(*smpl.grammar); + } + + return result; } void llama_sampling_reset_impl(struct llama_sampling & smpl, const char * grammar_str, const char * grammar_root) {