Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,9 @@ static bool common_params_parse_ex(int argc, char ** argv, common_params_context
}

if (params.escape) {
string_process_escapes(params.prompt);
if (!params.prompt_is_binary) {
string_process_escapes(params.prompt);
}
string_process_escapes(params.input_prefix);
string_process_escapes(params.input_suffix);
for (auto & antiprompt : params.antiprompt) {
Expand Down Expand Up @@ -1503,6 +1505,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
"prompt to start generation with; for system message, use -sys",
[](common_params & params, const std::string & value) {
params.prompt = value;
params.prompt_is_binary = false;
}
).set_excludes({LLAMA_EXAMPLE_SERVER}));
add_opt(common_arg(
Expand Down Expand Up @@ -1530,6 +1533,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
if (!params.prompt.empty() && params.prompt.back() == '\n') {
params.prompt.pop_back();
}
params.prompt_is_binary = false;
}
).set_excludes({LLAMA_EXAMPLE_SERVER}));
add_opt(common_arg(
Expand Down Expand Up @@ -1567,6 +1571,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
ss << file.rdbuf();
params.prompt = ss.str();
fprintf(stderr, "Read %zu bytes from binary file %s\n", params.prompt.size(), value.c_str());
params.prompt_is_binary = true;
}
).set_excludes({LLAMA_EXAMPLE_SERVER}));
add_opt(common_arg(
Expand Down
1 change: 1 addition & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ struct common_params {

bool multiple_choice = false; // compute TruthfulQA score over random tasks from datafile supplied in prompt
size_t multiple_choice_tasks = 0; // number of tasks to use when computing the TruthfulQA score. If 0, all tasks will be computed
bool prompt_is_binary = false; // don't fool around when the prompt contains binary data (as it is for multiple choice)

bool kl_divergence = false; // compute KL divergence

Expand Down
Loading