[GH-ISSUE #6103] show --modelfile doesn't properly quote MESSAGE statements #50327

Closed
opened 2026-04-28 15:10:02 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Maltz42 on GitHub (Jul 31, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6103

What is the issue?

Exporting a model file ("ollama show --modelfile MODEL") doesn't properly quote MESSAGE statements. As a result, the model file generated cannot be re-imported ("ollama create MODEL -f ) without modification. For example:

What is currently generated:
MESSAGE user write a humorous limerick
MESSAGE assistant There once was a fellow named Pete,
Whose dancing was quite incomplete.
He spun and he fell,
And let out a yell,
Now his dancing's no longer so neat!

Format it has to be in for re-importing:
MESSAGE user """write a humorous limerick"""
MESSAGE assistant """There once was a fellow named Pete,
Whose dancing was quite incomplete.
He spun and he fell,
And let out a yell,
Now his dancing's no longer so neat!"""

I do appreciate that it retains line breaks, though. That's handy when trying to extract the text for other applications.

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.3.1

Originally created by @Maltz42 on GitHub (Jul 31, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6103 ### What is the issue? Exporting a model file ("ollama show --modelfile MODEL") doesn't properly quote MESSAGE statements. As a result, the model file generated cannot be re-imported ("ollama create MODEL -f <modelfile>) without modification. For example: What is currently generated: MESSAGE user write a humorous limerick MESSAGE assistant There once was a fellow named Pete, Whose dancing was quite incomplete. He spun and he fell, And let out a yell, Now his dancing's no longer so neat! Format it has to be in for re-importing: MESSAGE user """write a humorous limerick""" MESSAGE assistant """There once was a fellow named Pete, Whose dancing was quite incomplete. He spun and he fell, And let out a yell, Now his dancing's no longer so neat!""" I do appreciate that it retains line breaks, though. That's handy when trying to extract the text for other applications. ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.3.1
GiteaMirror added the bug label 2026-04-28 15:10:02 -05:00
Author
Owner

@Maltz42 commented on GitHub (Aug 1, 2024):

Damn, that's got to be some kind of record! Thanks!

<!-- gh-comment-id:2261711468 --> @Maltz42 commented on GitHub (Aug 1, 2024): Damn, that's got to be some kind of record! Thanks!
Author
Owner

@Maltz42 commented on GitHub (Aug 3, 2024):

Unfortunately, this issue isn't fixed in 0.3.3 after all. The messages need to be surrounded by triple-quotes, not single quotes. Similar to the LICENSE statement. See again the example in my OP.

<!-- gh-comment-id:2266732968 --> @Maltz42 commented on GitHub (Aug 3, 2024): Unfortunately, this issue isn't fixed in 0.3.3 after all. The messages need to be surrounded by triple-quotes, not single quotes. Similar to the LICENSE statement. See again the example in my OP.
Author
Owner

@Maltz42 commented on GitHub (Aug 4, 2024):

After looking even further, it's much worse now than it was before the patch. Instead of no quotes at all, which could be fairly easily fixed with a few find/replace passes, now it inconsistently uses single quotes or triple-quotes, or five quotes ("""""), or still no quotes at all. It would be nice to either take another try at this, with more thorough testing, or just roll it back for now.

<!-- gh-comment-id:2267347058 --> @Maltz42 commented on GitHub (Aug 4, 2024): After looking even further, it's much worse now than it was before the patch. Instead of no quotes at all, which could be fairly easily fixed with a few find/replace passes, now it inconsistently uses single quotes or triple-quotes, or five quotes ("""""), or still no quotes at all. It would be nice to either take another try at this, with more thorough testing, or just roll it back for now.
Author
Owner

@Maltz42 commented on GitHub (Aug 5, 2024):

After further testing with v.0.3.2, before this patch, even that version sometimes terminates MESSAGE content with """, but usually not, and sometimes colons in the assistant text are converted to triple-quotes. MESSAGE statement export seems very broken.

<!-- gh-comment-id:2268005404 --> @Maltz42 commented on GitHub (Aug 5, 2024): After further testing with v.0.3.2, before this patch, even that version sometimes terminates MESSAGE content with """, but usually not, and sometimes colons in the assistant text are converted to triple-quotes. MESSAGE statement export seems very broken.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#50327