8000 log prompt + nits · ochafik/llama.cpp@8205246 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8205246

Browse files
author
Olivier Chafik
committed
log prompt + nits
1 parent f223df0 commit 8205246

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

examples/server/server.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3823,7 +3823,9 @@ int main(int argc, char ** argv) {
38233823
std::vector<server_task> tasks;
38243824

38253825
try {
3826-
std::vector<llama_tokens> tokenized_prompts = tokenize_input_prompts(ctx_server.vocab, data.at("prompt"), true, true);
3826+
const auto & prompt = data.at("prompt");
3827+
LOG_DBG("Prompt: %s\n", prompt.is_string() ? prompt.get<std::string>().c_str() : prompt.dump(2).c_str());
3828+
std::vector<llama_tokens> tokenized_prompts = tokenize_input_prompts(ctx_server.vocab, prompt, true, true);
38273829
tasks.reserve(tokenized_prompts.size());
38283830
for (size_t i = 0; i < tokenized_prompts.size(); i++) {
38293831
server_task task = server_task(type);

examples/server/tests/unit/test_chat_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create_server():
1515
[
1616
(None, "Book", "What is the best book", 8, "(Suddenly)+|\\{ \" Sarax.", 77, 8, "length", False, None),
1717
(None, "Book", "What is the best book", 8, "(Suddenly)+|\\{ \" Sarax.", 77, 8, "length", True, None),
18-
(None, "Book", "What is the best book", 8, "^ blue|I want to play with", 23, 8, "length", True, "This is not a chat template, it is"),
18+
(None, "Book", "What is the best book", 8, "I want to play with", 23, 8, "length", True, "This is not a chat template, it is"),
1919
("codellama70b", "You are a coding assistant.", "Write the fibonacci function in c++.", 128, "(Aside|she|felter|alonger)+", 104, 64, "length", False, None),
2020
("codellama70b", "You are a coding assistant.", "Write the fibonacci function in c++.", 128, "(Aside|she|felter|alonger)+", 104, 64, "length", True, None),
2121
]

src/llama-grammar.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ struct llama_grammar {
118118
// lazy grammars wait for trigger words or tokens before constraining the sampling.
119119
// we still ahve trigger_tokens for non-lazy grammars to force printing of special trigger tokens.
120120
// (useful e.g. for tool_choice=required)
121-
bool lazy;
122-
bool awaiting_trigger; // Initialized to true for lazy grammars only
123-
std::string trigger_buffer; // Output buffered by lazy grammar. Will be cleared once trigger is found.
124-
std::vector<llama_token> trigger_tokens; // Tokens that trigger a lazy grammar, or tokens to force printing of (even if special).
121+
bool lazy = false;
122+
bool awaiting_trigger = false; // Initialized to true for lazy grammars only
123+
std::string trigger_buffer; // Output buffered by lazy grammar. Will be cleared once trigger is found.
124+
std::vector<llama_token> trigger_tokens; // Tokens that trigger a lazy grammar, or tokens to force printing of (even if special).
125125
std::vector<std::string> trigger_words;
126126
};
127127

0 commit comments

Comments
 (0)
0