ggerganov / llama.cpp

LLM inference in C/C++
MIT License
67.08k stars 9.63k forks source link

SIGSEGV on moderately complex grammar #7810

Open hoehrmann opened 4 months ago

hoehrmann commented 4 months ago

(In #7572 @HanClinto wrote:)

@HanClinto Further down in the gist https://gist.github.com/hoehrmann/f234c1156ee5ef7b24cb589c14aaefda?permalink_comment_id=5070397#gistcomment-5070397 is a variant where I removed the redundant empty string alternative. llamap.cpp then goes into SIGSEGV after a couple of lines (or pretty much immediately if you change the root to the <middle> section of the grammar) asking a model to write an Internet-Draft in xml2rfc format.

Confirmed, thank you! I ran the following command:

./main -mu https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF/resolve/main/Hermes-2-Pro-Mistral-7B.Q4_K_M.gguf \
    --grammar-file ./grammars/issue7572.gbnf \
    -p "Please generate an Internet-Draft in xml2rfc format." \
    --seed 12345

And it crashed after:

 Please generate an Internet-Draft in xml2rfc format.<rfc>
<front><title>Test</title><author><organization>IETF</organization><address><email>jdoe@example.com</email></address></author><date>
</date>
</front><middle>
<section>
<./test_7572.sh: line 4: 72743 Segmentation fault: 11  ./main -mu https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF/resolve/main/Hermes-2-Pro-Mistral-7B.Q4_K_M.gguf --grammar-file ./grammars/issue7572.gbnf -p "Please generate an Internet-Draft in xml2rfc format." --seed 12345
github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.