[GH-ISSUE #8542] Try to add finetuned model MiniCPM-V 2.6 #5510

Closed
opened 2026-04-12 16:45:38 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @nvip12041994 on GitHub (Jan 23, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8542

FROM ./MiniCPM-V-2_6_cuda/model/ggml-model-Q4_K_M.gguf ADAPTER ./MiniCPM-V-2_6_cuda/mmproj-model-f16.gguf TEMPLATE """{{- if .Messages }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1 -}} <|im_start|>{{ .Role }} {{ .Content }} {{- if $last }} {{- if (ne .Role "assistant") }}<|im_end|> <|im_start|>assistant {{ end }} {{- else }}<|im_end|> {{ end }} {{- end }} {{- else }} {{- if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user {{ .Prompt }}<|im_end|> {{ end }}<|im_start|>assistant {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}""" PARAMETER stop <|im_start|> PARAMETER stop <|im_end|>

I use above modelfile to create ollama model, but I got the following error, please help me

 docker exec -it ollama ollama create aifinancevlm:latest -f /mnt/data/fintuned_minicpm.modelfile
gathering model components
copying file sha256:79b334b0c69c2d77fabc3a4449eaf8785b758e9a2132ab6c0fcd83d4e30a2070 100%
copying file sha256:99c55b4f5fb463098d936e17039387b54ba52f06849248f4d38e69da8fd1d307 100%
parsing GGUF
Error: invalid file magic
Originally created by @nvip12041994 on GitHub (Jan 23, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8542 `FROM ./MiniCPM-V-2_6_cuda/model/ggml-model-Q4_K_M.gguf ADAPTER ./MiniCPM-V-2_6_cuda/mmproj-model-f16.gguf TEMPLATE """{{- if .Messages }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1 -}} <|im_start|>{{ .Role }} {{ .Content }} {{- if $last }} {{- if (ne .Role "assistant") }}<|im_end|> <|im_start|>assistant {{ end }} {{- else }}<|im_end|> {{ end }} {{- end }} {{- else }} {{- if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user {{ .Prompt }}<|im_end|> {{ end }}<|im_start|>assistant {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}""" PARAMETER stop <|im_start|> PARAMETER stop <|im_end|>` I use above modelfile to create ollama model, but I got the following error, please help me ``` docker exec -it ollama ollama create aifinancevlm:latest -f /mnt/data/fintuned_minicpm.modelfile gathering model components copying file sha256:79b334b0c69c2d77fabc3a4449eaf8785b758e9a2132ab6c0fcd83d4e30a2070 100% copying file sha256:99c55b4f5fb463098d936e17039387b54ba52f06849248f4d38e69da8fd1d307 100% parsing GGUF Error: invalid file magic ```
Author
Owner

@rick-github commented on GitHub (Jan 23, 2025):

One of your files may have trailing padding bytes which fail the file magic check. See here for a hacky way to fix it.

<!-- gh-comment-id:2608604630 --> @rick-github commented on GitHub (Jan 23, 2025): One of your files may have trailing padding bytes which fail the `file magic` check. See [here](https://github.com/ollama/ollama/issues/5939#issuecomment-2468626194) for a hacky way to fix it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5510