Don't allow grammar json array to output unescaped new line in string#5885
Don't allow grammar json array to output unescaped new line in string#5885ggerganov merged 2 commits intoggml-org:masterfrom ExtReMLapin:patch-1
Conversation
|
Related to IntrinsicLabsAI/gbnfgen#31 |
|
Oopsie woopsie, I did a mistake
Won't actually BLOCK \ characters and new lines, it will interpret \\ to block and the letter n (lowercase only) Example :
And giving a try with :
Segfaults (llama_sampling_init: failed to parse grammar) Now, my question is , from original grammar file: |
|
Hm, not sure - if you find something that works, open a PR. For now I reverted the change |
|
Thanks for reverting, i'll do more investigations, it could also be caused by my terminal interpreting the anti slashes |
|
Alright, it seems that my command line interpreter was causing the \ + lower case N interpretation, and even with that, it was not fully fixed because I forgot about carriage return. I'll take some time to see if there are others nasty characters that can cause troubles with json strings |
…rg#5885) * Don't allow grammar json array to output unescaped new line in string * Don't allow new line in json object string
…ggml-org#5885)" This reverts commit b1a4e99.
…rg#5885) * Don't allow grammar json array to output unescaped new line in string * Don't allow new line in json object string
…ggml-org#5885)" This reverts commit b1a4e99.
I had this issue where the generated json was this (with a another grammar file)
{"entities": [ {"type": "Geo-Political Entity", "name": "Paris 2024"}, {"type": "Location", "name": "Paris"}], "relations": [{"type_from": "G', eographic Feature", "name_from": "Paris", "type_to": "Event", "name_to": "Paris 2024", "relation_type": "occurs_in"}]}For the grammar builder I came up with this solution