Commit 00c6390
main : don't print special tokens with --grammar (ggml-org#6923)
* main : don't print special tokens with --grammar
The CLI interface was recently changed to print special control tokens
like the </s> stop message one. This token shouldn't be printed if the
grammar flag was passed, unless the grammar specifies it, because that
breaks shell-scriptability.
* main: use seperate stream for control characters
* main: use dprintf and add --ctrl-token-no-out and --ctrl-token-fd-out
* main: dprintf isn't part of the IEEE POSIX standard. Just use write().
* main: remove --ctrl-token-fd-out in favor for fcntl() based detection
* common.cpp: accidentally removed --interactive-first
* main: only merge stdout and control token if not in conversation or grammar mode
* main: rejig control token descriptor handling
* main: must check pipe status on very top of program
* main: renamed --no-special from --ctrl-token-no-out and other refactoring
* main: refactor ctrl_token_no_out --> no_special
* llama: rename llama_token_is_control_token() to llama_token_is_control()
* main: remove special token file descriptor feature (#5)
---------
Co-authored-by: Brian <mofosyne@gmail.com>1 parent faa0e69 commit 00c6390
5 files changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
904 | 904 | | |
905 | 905 | | |
906 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
907 | 911 | | |
908 | 912 | | |
909 | 913 | | |
| |||
1364 | 1368 | | |
1365 | 1369 | | |
1366 | 1370 | | |
| 1371 | + | |
1367 | 1372 | | |
1368 | 1373 | | |
1369 | 1374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
744 | | - | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
745 | 753 | | |
| 754 | + | |
| 755 | + | |
746 | 756 | | |
| 757 | + | |
747 | 758 | | |
748 | 759 | | |
| 760 | + | |
749 | 761 | | |
750 | 762 | | |
751 | 763 | | |
| 764 | + | |
| 765 | + | |
752 | 766 | | |
753 | | - | |
754 | 767 | | |
| 768 | + | |
755 | 769 | | |
756 | 770 | | |
757 | 771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17861 | 17861 | | |
17862 | 17862 | | |
17863 | 17863 | | |
| 17864 | + | |
| 17865 | + | |
| 17866 | + | |
| 17867 | + | |
17864 | 17868 | | |
17865 | 17869 | | |
17866 | 17870 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
826 | 829 | | |
827 | 830 | | |
828 | 831 | | |
| |||
0 commit comments