Help with grammars, beginner #11464
-
I wanted to use grammars with Llama. I have slightly modified the "simple" example and modified the following segment from line 125:
My prompt is "Charlie yelled with the first of a hurricane. Charlie is ". I thought given the gbnf I gave that the next word outputted is "Angry". However I get the error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Try to put the grammar at the start of the chain. Also, in general you need to accept all tokens from the prompt by calling the |
Beta Was this translation helpful? Give feedback.
Try to put the grammar at the start of the chain.
Also, in general you need to accept all tokens from the prompt by calling the
llama_sampler_accept()
function for each token. This will initialize the state of the grammar sampler with the prompt. Probably not needed for this particular case, but still better to do it.