ollama / ollama

Get up and running with Llama 3.2, Mistral, Gemma 2, and other large language models.
https://ollama.com
MIT License
91.68k stars 7.21k forks source link

Error "transferring model data " when creating a model #4998

Closed tigerkin89 closed 3 months ago

tigerkin89 commented 3 months ago

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

jmorganca commented 3 months ago

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?

tigerkin89 commented 3 months ago

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

jasonm23 commented 3 months ago

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
jasonm23 commented 3 months ago

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.

jmorganca commented 3 months ago

Sorry about this - will take a look!

jasonm23 commented 3 months ago

@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.

joshyan1 commented 3 months ago

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

tigerkin89 commented 3 months ago

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..

joshyan1 commented 3 months ago

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

paulgear commented 1 week ago

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.