Skip to content

Commit 8795d1d

Browse files
committed
fix build
ggml-ci
1 parent 850e853 commit 8795d1d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/llama-grammar.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "llama-sampling.h"
55

66
#include <algorithm>
7+
#include <stdexcept>
78

89
//
910
// helpers

src/llama-sampling.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ void llama_sampling_free_impl(struct llama_sampling * sampling) {
4848
}
4949

5050
struct llama_sampling * llama_sampling_cp_impl(const struct llama_sampling & smpl) {
51-
GGML_ASSERT(false); // Not implemented
51+
auto * result = new llama_sampling(smpl.n_vocab);
52+
53+
if (smpl.grammar) {
54+
result->grammar = llama_grammar_copy_impl(*smpl.grammar);
55+
}
56+
57+
return result;
5258
}
5359

5460
void llama_sampling_reset_impl(struct llama_sampling & smpl, const char * grammar_str, const char * grammar_root) {

0 commit comments

Comments
 (0)