main : minor
This commit is contained in:
parent
60325ec78e
commit
98dae326b1
1 changed files with 8 additions and 8 deletions
|
@ -511,6 +511,14 @@ int main(int argc, char ** argv) {
|
||||||
std::vector<llama_token> embd;
|
std::vector<llama_token> embd;
|
||||||
std::vector<llama_token> embd_guidance;
|
std::vector<llama_token> embd_guidance;
|
||||||
|
|
||||||
|
// tokenized antiprompts
|
||||||
|
std::vector<std::vector<llama_token>> antiprompt_ids;
|
||||||
|
|
||||||
|
antiprompt_ids.reserve(params.antiprompt.size());
|
||||||
|
for (const std::string & antiprompt : params.antiprompt) {
|
||||||
|
antiprompt_ids.emplace_back(::llama_tokenize(ctx, antiprompt, false, true));
|
||||||
|
}
|
||||||
|
|
||||||
struct llama_sampling_context * ctx_sampling = llama_sampling_init(sparams);
|
struct llama_sampling_context * ctx_sampling = llama_sampling_init(sparams);
|
||||||
|
|
||||||
while ((n_remain != 0 && !is_antiprompt) || params.interactive) {
|
while ((n_remain != 0 && !is_antiprompt) || params.interactive) {
|
||||||
|
@ -769,14 +777,6 @@ int main(int argc, char ** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tokenize reverse/antiprompt special tokens only once using static
|
|
||||||
static std::vector<std::vector<llama_token>> antiprompt_ids;
|
|
||||||
if (antiprompt_ids.empty()) {
|
|
||||||
for (std::string& antiprompt : params.antiprompt) {
|
|
||||||
antiprompt_ids.push_back(::llama_tokenize(ctx, antiprompt, false, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for reverse prompt using special tokens
|
// check for reverse prompt using special tokens
|
||||||
llama_token last_token = llama_sampling_last(ctx_sampling);
|
llama_token last_token = llama_sampling_last(ctx_sampling);
|
||||||
for (std::vector<llama_token> ids : antiprompt_ids) {
|
for (std::vector<llama_token> ids : antiprompt_ids) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue