Re:Show HN: Grammar Generator App for Llama.cpp
by tkgally on Wednesday August 02, 2023 @10:13PM
(#36980529)
You might want to add an appropriate modifier before “grammar” on your top page to indicate your domain.
Being a natural-language person, I thought your tool might be something that, say, generates rules for verb conjugations from a corpus of a human language.
1. In the app, write a TypeScript schema for this, one good example could be
If you click Generate you'll see it generate a context-free grammar looking text, which is what llama.cpp reads. Click the download file to save it as grammar.gbnf2. Grab a model for llama.cpp, e.g. this quantized Llama2 chat model: https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/blob/ma...
3. Grab the prompt in this gist (https://gist.github.com/a10y/d926039eee63cc2bcaf6345f9a419e3...) and save as prompt.txt
4. Compile a recent commit of llama.cpp and run the following command
EDIT: fixed some typos