Support special tokens as reverse/anti prompt.

This commit is contained in:
DAN™ 2024-03-02 21:56:45 -05:00
parent 9731134296
commit ef651247d0

View file

@ -760,7 +760,8 @@ int main(int argc, char ** argv) {
? last_output.length() - static_cast<size_t>(antiprompt.length() + extra_padding) ? last_output.length() - static_cast<size_t>(antiprompt.length() + extra_padding)
: 0; : 0;
if (last_output.find(antiprompt, search_start_pos) != std::string::npos) { auto tmp = ::llama_tokenize(ctx, antiprompt, false, true);
if (last_output.find(antiprompt, search_start_pos) != std::string::npos || (tmp.size() == 1 && llama_sampling_last(ctx_sampling) == tmp[0])) {
if (params.interactive) { if (params.interactive) {
is_interacting = true; is_interacting = true;
} }