Skip to content

Commit 9a6847c

Browse files
author
ochafik
committed
move trigger_words init inside non-llguidance branch
1 parent 18a11f4 commit 9a6847c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

common/sampling.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ struct common_sampler * common_sampler_init(const struct llama_model * model, co
151151

152152
lparams.no_perf = params.no_perf;
153153

154-
std::vector<const char *> trigger_words;
155-
trigger_words.reserve(params.grammar_trigger_words.size());
156-
for (const auto & str : params.grammar_trigger_words) {
157-
trigger_words.push_back(str.word.c_str());
158-
}
159-
160154
struct llama_sampler * grmr;
161155
if (params.grammar.compare(0, 11, "%llguidance") == 0) {
162156
#ifdef LLAMA_USE_LLGUIDANCE
@@ -165,6 +159,12 @@ struct common_sampler * common_sampler_init(const struct llama_model * model, co
165159
GGML_ABORT("llguidance (cmake -DLLAMA_LLGUIDANCE=ON) is not enabled");
166160
#endif // LLAMA_USE_LLGUIDANCE
167161
} else {
162+
std::vector<const char *> trigger_words;
163+
trigger_words.reserve(params.grammar_trigger_words.size());
164+
for (const auto & str : params.grammar_trigger_words) {
165+
trigger_words.push_back(str.word.c_str());
166+
}
167+
168168
grmr = params.grammar_lazy
169169
? llama_sampler_init_grammar_lazy(vocab, params.grammar.c_str(), "root",
170170
trigger_words.data(), trigger_words.size(),

0 commit comments

Comments
 (0)