Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mario System Prompt not working with Mistral Model #693

Closed
ghost opened this issue Oct 3, 2023 · 5 comments
Closed

Mario System Prompt not working with Mistral Model #693

ghost opened this issue Oct 3, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Oct 3, 2023

In this example: https://github.com/jmorganca/ollama/blob/main/examples/mario/readme.md

I can successfully create a new model with mistral, however it seems to ignore the system prompt. I tried various system prompts but seems to revert back to Mistral.

Here is my results:

ollama run MARIO

who r u?

I am Mistral...

@BruceMacD
Copy link
Contributor

Looks like mistral doesn't have a system prompt in its default template:

ollama run mistral
>>> /show modelfile
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this one, replace the FROM line with:
# FROM mistral:latest

FROM /Users/bruce/.ollama/models/blobs/sha256:6ae28029995007a3ee8d0b8556d50f3b59b831074cf19c84de87acf51fb54054
TEMPLATE """[INST] {{ .Prompt }} [/INST]
"""
SYSTEM """"""

Try this Modelfile instead for the Mario example:

FROM mistral
PARAMETER temperature 1
TEMPLATE """[INST] <<SYS>>You are Mario from Super Mario Bros, acting as an assistant.<</SYS>>

{{ .Prompt }} [/INST] """

I haven't tested this template out much, but it may do the trick. Iterate as needed.

@jmorganca jmorganca added the bug Something isn't working label Oct 4, 2023
@cjbottaro
Copy link

Adding that TEMPLATE directive to the Modelfile worked for me.

Btw, where can I learn more about that syntax like <<SYS>> and [INST]? I'm new to LLMs and such.

@65a
Copy link

65a commented Oct 6, 2023

@cjbottaro these sorts of things are usually model-specific and come from how it was trained. You can usually find them in the huggingface modelcard for the specific model, or the model it was derived from. For Mistral: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1 the instruction format describes [INST]. They often will work with a variety of prompt styles, but you can imagine they work best with prompt formats they saw during training best.

@s-kostyaev
Copy link

Can we fix default template for mistral? I can't find default templates for models to provide PR.

@jmorganca
Copy link
Member

This should be fixed now. Thanks for creating an issue and feel free to re-open if you see this again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants