[GH-ISSUE #4998] Error "transferring model data " when creating a model #3161

Closed
opened 2026-04-12 13:38:47 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @tigerkin89 on GitHub (Jun 12, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4998

What is the issue?

When I create model , error happen like "Error: invalid model reference: qwen2-7b-instruct-q8_0.gguf".

$ ollama create qwen2.7b -f ./Modelfile
transferring model data
Error: invalid model reference: qwen2-7b-instruct-q8_0.gguf

$ more Modelfile
FROM qwen2-7b-instruct-q8_0.gguf
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ .Response }}<|im_end|>
"""

PARAMETER num_ctx 64000
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"

$ ls
Modelfile qwen2-7b-instruct-q8_0.gguf

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.1.43

Originally created by @tigerkin89 on GitHub (Jun 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4998 ### What is the issue? When I create model , error happen like "Error: invalid model reference: qwen2-7b-instruct-q8_0.gguf". $ ollama create qwen2.7b -f ./Modelfile transferring model data Error: invalid model reference: qwen2-7b-instruct-q8_0.gguf $ more Modelfile FROM qwen2-7b-instruct-q8_0.gguf TEMPLATE """{{ if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user {{ .Prompt }}<|im_end|> {{ end }}<|im_start|>assistant {{ .Response }}<|im_end|> """ PARAMETER num_ctx 64000 PARAMETER stop "<|im_start|>" PARAMETER stop "<|im_end|>" $ ls Modelfile qwen2-7b-instruct-q8_0.gguf ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.1.43
GiteaMirror added the bug label 2026-04-12 13:38:47 -05:00
Author
Owner

@jmorganca commented on GitHub (Jun 12, 2024):

Hi @tigerkin89 can you try with FROM ./qwen2-7b-instruct-q8_0.gguf. Your Modelfile syntax is valid, but it seems that it can't find the file on disk. Do you know if there are permission issues or anything else?

<!-- gh-comment-id:2163554844 --> @jmorganca commented on GitHub (Jun 12, 2024): Hi @tigerkin89 can you try with `FROM ./qwen2-7b-instruct-q8_0.gguf`. Your Modelfile syntax is valid, but it seems that it can't find the file on disk. Do you know if there are permission issues or anything else?
Author
Owner

@tigerkin89 commented on GitHub (Jun 12, 2024):

Hi @tigerkin89 can you try with FROM ./qwen2-7b-instruct-q8_0.gguf. Your Modelfile syntax is valid, but it seems that it can't find the file on disk. Do you know if there are permission issues or anything else?

Thanks your reply.

I modify permission to 666 and 777. Same Problems happened..

With previous ollama version, I made model successfully. But with ollama version =0.1.43, I get error.

$ ls -l
total 7908724
-rw-rw-r--. 1 hankh hankh 317 Jun 13 08:23 Modelfile
-rwxrwxrwx. 1 hankh hankh 8098522656 Jun 11 18:24 qwen2-7b-instruct-q8_0.gguf

$ ollama list
NAME ID SIZE MODIFIED
qwen2-7b:latest 00dfe32ae268 8.1 GB 2 days ago
qwen2:7b e0d4e1163c58 4.4 GB 2 days ago

$ ollama create qwen2-7b:latest -f Modelfile
transferring model data
Error: invalid model reference: ./qwen2-7b-instruct-q8_0.gguf

$ file ./qwen2-7b-instruct-q8_0.gguf
./qwen2-7b-instruct-q8_0.gguf: data

<!-- gh-comment-id:2164068808 --> @tigerkin89 commented on GitHub (Jun 12, 2024): > Hi @tigerkin89 can you try with `FROM ./qwen2-7b-instruct-q8_0.gguf`. Your Modelfile syntax is valid, but it seems that it can't find the file on disk. Do you know if there are permission issues or anything else? Thanks your reply. I modify permission to 666 and 777. Same Problems happened.. With previous ollama version, I made model successfully. But with ollama version =0.1.43, I get error. $ ls -l total 7908724 -rw-rw-r--. 1 hankh hankh 317 Jun 13 08:23 Modelfile -rwxrwxrwx. 1 hankh hankh 8098522656 Jun 11 18:24 qwen2-7b-instruct-q8_0.gguf $ ollama list NAME ID SIZE MODIFIED qwen2-7b:latest 00dfe32ae268 8.1 GB 2 days ago qwen2:7b e0d4e1163c58 4.4 GB 2 days ago $ ollama create qwen2-7b:latest -f Modelfile transferring model data Error: invalid model reference: ./qwen2-7b-instruct-q8_0.gguf $ file ./qwen2-7b-instruct-q8_0.gguf ./qwen2-7b-instruct-q8_0.gguf: data
Author
Owner

@jasonm23 commented on GitHub (Jun 20, 2024):

Also experiencing the same, with an even simpler Modelfile

ollama create mistrallite -f ./Modelfile
transferring model data
Error: invalid model reference: ~/Downloads/mistrallite.Q5_K_M.gguf

Modelfile

FROM ~/Downloads/mistrallite.Q5_K_M.gguf
ls -la ~/Downloads/mistrallite.Q5_K_M.gguf
-rw-r--r-- 1 jason jason 5131427680 Jun 20 13:11 /home/jason/Downloads/mistrallite.Q5_K_M.gguf
<!-- gh-comment-id:2179915916 --> @jasonm23 commented on GitHub (Jun 20, 2024): Also experiencing the same, with an even simpler `Modelfile` ``` ollama create mistrallite -f ./Modelfile transferring model data Error: invalid model reference: ~/Downloads/mistrallite.Q5_K_M.gguf ``` Modelfile ``` FROM ~/Downloads/mistrallite.Q5_K_M.gguf ``` ``` ls -la ~/Downloads/mistrallite.Q5_K_M.gguf -rw-r--r-- 1 jason jason 5131427680 Jun 20 13:11 /home/jason/Downloads/mistrallite.Q5_K_M.gguf ```
Author
Owner

@jasonm23 commented on GitHub (Jun 20, 2024):

For me it was because there was a space at the end of:

FROM ~/Downloads/mistrallite.Q5_K_M.gguf # < trailing space 

Removing it fixed the issue.

<!-- gh-comment-id:2179917623 --> @jasonm23 commented on GitHub (Jun 20, 2024): For me it was because there was a space at the end of: ``` FROM ~/Downloads/mistrallite.Q5_K_M.gguf # < trailing space ``` Removing it fixed the issue.
Author
Owner

@jmorganca commented on GitHub (Jun 25, 2024):

Sorry about this - will take a look!

<!-- gh-comment-id:2188020708 --> @jmorganca commented on GitHub (Jun 25, 2024): Sorry about this - will take a look!
Author
Owner

@jasonm23 commented on GitHub (Jun 25, 2024):

@jmorganca I think this is correct behavior.

While people will not generally name things with trailing spaces, they might.

It's perhaps better to treat the line as a literal filename and place a caveat in the docs.

<!-- gh-comment-id:2188165325 --> @jasonm23 commented on GitHub (Jun 25, 2024): @jmorganca I think this is correct behavior. While people will not generally name things with trailing spaces, they might. It's perhaps better to treat the line as a literal filename and place a caveat in the docs.
Author
Owner

@joshyan1 commented on GitHub (Jun 26, 2024):

Hey @tigerkin89, I'm having troubles reproducing this error locally. Can you check if the trailing space is the issue?

<!-- gh-comment-id:2192609511 --> @joshyan1 commented on GitHub (Jun 26, 2024): Hey @tigerkin89, I'm having troubles reproducing this error locally. Can you check if the trailing space is the issue?
Author
Owner

@tigerkin89 commented on GitHub (Jun 27, 2024):

Hey @tigerkin89, I'm having troubles reproducing this error locally. Can you check if the trailing space is the issue?

Thanks your concerns!!

there is no trailing space in a modelfile..

<!-- gh-comment-id:2193793275 --> @tigerkin89 commented on GitHub (Jun 27, 2024): > Hey @tigerkin89, I'm having troubles reproducing this error locally. Can you check if the trailing space is the issue? Thanks your concerns!! there is no trailing space in a modelfile..
Author
Owner

@joshyan1 commented on GitHub (Jul 1, 2024):

Closed with: https://github.com/ollama/ollama/pull/5336
Please reopen if this issues reoccurs

<!-- gh-comment-id:2201429148 --> @joshyan1 commented on GitHub (Jul 1, 2024): Closed with: https://github.com/ollama/ollama/pull/5336 Please reopen if this issues reoccurs
Author
Owner

@paulgear commented on GitHub (Sep 19, 2024):

For the benefit of future travellers who might encounter this error message: the FROM directive is relative to the Modelfile's location, not the current directory.

So, if your source .gguf file is in /foo/bar/model.gguf, your Modelfile is /foo/baz/Modelfile, and your working directory is /foo/bar, you cannot run ollama create -f ../baz/Modelfile mymodel if your Modelfile contains FROM ./model.gguf; you must instead use FROM ../bar/model.gguf or FROM /foo/bar/model.gguf.

<!-- gh-comment-id:2359726541 --> @paulgear commented on GitHub (Sep 19, 2024): For the benefit of future travellers who might encounter this error message: the `FROM` directive is relative to the Modelfile's location, not the current directory. So, if your source .gguf file is in `/foo/bar/model.gguf`, your Modelfile is `/foo/baz/Modelfile`, and your working directory is `/foo/bar`, you cannot run `ollama create -f ../baz/Modelfile mymodel` if your Modelfile contains `FROM ./model.gguf`; you must instead use `FROM ../bar/model.gguf` or `FROM /foo/bar/model.gguf`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#3161