Skip to content

Commit 6018c9d

Browse files
authored
Fix Stopwords/Antiprompt (#248)
Signed-off-by: 65a <[email protected]>
1 parent 79f9587 commit 6018c9d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

binding.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,17 @@ int llama_predict(void* params_ptr, void* state_pr, char* result, bool debug) {
513513
: 0;
514514

515515
if (last_output.find(antiprompt, search_start_pos) != std::string::npos) {
516+
is_antiprompt = true;
516517
break;
517518
}
518519
}
519520
}
520521
}
522+
523+
// found antiprompt
524+
if (is_antiprompt) {
525+
break;
526+
}
521527

522528
// end of text token
523529
if (!embd.empty() && embd.back() == llama_token_eos(ctx)) {

0 commit comments

Comments
 (0)