Open chris-cortner opened 10 months ago
Looks like a related issue was previously closed but another person was still reporting the issue in v0.1.10 Issue #556
Also, I'm running from main as of 2 days ago.
Seems to work fine with neural-chat, which is Mistral based but uses a different system prompt format:
"### System:\n{system_prompt}\n\n### User:\n{prompt}\n\n### Assistant:\n"
I'm facing a similar issue, I get an assertion error when using the ChatML format. Is there a fix for that?
I also added a discussion topic, hoping someone will chime in with a workaround.
I'm facing a similar issue but it works if I use LlamaCppChat model instead of HuggingFaceChat model. Also it's specifically to do with the<|
and |>
because if I replace them with <<
and >>
the prompt works just fine.
Very interesting, thanks for the tip!
I'm trying to apply dolphin mistral's prompt template format:
<|im_start|>system {system_prompt}<|im_end|> <|im_start|>user {user_prompt}<|im_end|> <|im_start|>assistant
I've tried this a couple of different ways:
quant_path = "TheBloke/dolphin-2.6-mistral-7B-AWQ" lm = models.Transformers(quant_path, device_map="auto") stop_char = '"' prompt_template = '<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n'
lm2 = lm + (prompt_template.format(system_prompt="You are a helpful AI", prompt="What is the distance to mars?")
And by using TransformersChat:
quant_path = "TheBloke/dolphin-2.6-mistral-7B-AWQ" lm = models.TransformersChat(quant_path, device_map="auto") stop_char = '"'
with system(): lm2 = lm + "You are a helpful AI"
with user(): lm2 += "What is the distance to mars?"
with assistant(): lm2 += 'The distance to mars is "' + gen("answer", max_tokens=500, stop=stop_char, temperature=0.8)
Both method produce the same error:
An assertion error is thrown in _cleanup_tokens in _model.py
Traceback (most recent call last): File "/home/user/.cache/pypoetry/virtualenvs/llm-proficiency-testing-hKJXaDzo-py3.11/lib64/python3.11/site-packages/guidance/models/_model.py", line 309, in add out = lm + partial_grammar