我在尝试使用Ollama创建自定义模型时,运行以下命令时遇到了问题:
ollama create my-custom-model
我收到了以下错误信息:
Error: (line 1): command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message"
我已经按照说明创建了一个Modelfile
,内容如下:
from: llama3.2:latestlicense: opensystem: | You are AdelBot, a friendly chatbot designed by Adel. Your responses are concise and include emojis for clarity and fun! 
message: - role: user content: Who are you? - role: assistant content: I'm AdelBot, here to assist you with clear and concise answers. 
然而,我仍然收到相同的错误。
有人能帮我理解为什么会出现这个错误以及如何解决吗?
我已经尝试过的方法:
- 仔细检查了
Modelfile
中的缩进。 - 确保我使用了正确的命令(
from
,license
,system
,message
)。 - 使用了
llama3.2:latest
模型,该模型在我系统上可用。
回答:
我也有过同样的问题,我尝试在system
关键字后传递消息,但消息不是单行。所以我完全用三引号(“””完整提示”””)编码了提示。我的提示也从System
关键字的同一行开始。
你可以尝试像下面这样添加消息。
from: llama3.2:latestlicense: opensystem: """ You are AdelBot, a friendly chatbot designed by Adel. Your responses are concise and include emojis for clarity and fun! 
"""message: - role: user content: Who are you? - role: assistant content: I'm AdelBot, here to assist you with clear and concise answers. 
我用三引号包围了文本,或者你可以尝试将其放在一行中,因为提示较短。
我使用了Java库并遇到了相同的问题。这些引号解决了我的问题。希望这对你有帮助!