We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
--reverse-prompt
1 parent b4efd77 commit c82d48eCopy full SHA for c82d48e
tools/main/main.cpp
@@ -785,14 +785,17 @@ int main(int argc, char ** argv) {
785
}
786
787
// check for reverse prompt using special tokens
788
- llama_token last_token = common_sampler_last(smpl);
789
- for (auto token : antiprompt_token) {
790
- if (token == last_token) {
791
- if (params.interactive) {
792
- is_interacting = true;
+ // avoid calling common_sampler_last() if last_output is empty
+ if (!last_output.empty()) {
+ llama_token last_token = common_sampler_last(smpl);
+ for (auto token : antiprompt_token) {
+ if (token == last_token) {
793
+ if (params.interactive) {
794
+ is_interacting = true;
795
+ }
796
+ is_antiprompt = true;
797
+ break;
798
- is_antiprompt = true;
- break;
799
800
801
0 commit comments