[GH-ISSUE #6629] Fail to Convert Huggingface Llama3.1 with ollama create #66209

Closed
opened 2026-05-04 00:50:08 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @YueChenkkk on GitHub (Sep 4, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6629

Originally assigned to: @pdevine on GitHub.

What is the issue?

I downloaded the meta-llama-3.1-8b model from huggingface. [https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct]

And I installed ollama-linux-amd64 (version==0.3.6) manually.

When I start the service with ollama serve &, it seems nothing goes wrong.

But after I build a Modelfile with only FROM . in the huggingface model directory and try to create a ollama model with ollama create my-llama-model, I got the following error message:

usr-yc@lm-machine:~/models/vanilla-llama-3.1-8b$ ollama create my-llama-model
[GIN] 2024/09/04 - 15:12:28 | 200 |      23.352µs |       127.0.0.1 | HEAD     "/"
transferring model data ⠙ [GIN] 2024/09/04 - 15:13:00 | 200 |     168.198µs |       127.0.0.1 | POST     "/api/blobs/sha256:xxxxxxx"
[GIN] 2024/09/04 - 15:13:00 | 200 |    5.022104ms |       127.0.0.1 | POST     "/api/create"
transferring model data 100%
converting model
Error: proto: cannot parse invalid wire-format data

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.3.6

Originally created by @YueChenkkk on GitHub (Sep 4, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6629 Originally assigned to: @pdevine on GitHub. ### What is the issue? I downloaded the meta-llama-3.1-8b model from huggingface. [https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct] And I installed ollama-linux-amd64 (version==0.3.6) manually. When I start the service with `ollama serve &`, it seems nothing goes wrong. But after I build a Modelfile with only `FROM .` in the huggingface model directory and try to create a ollama model with `ollama create my-llama-model`, I got the following error message: ``` usr-yc@lm-machine:~/models/vanilla-llama-3.1-8b$ ollama create my-llama-model [GIN] 2024/09/04 - 15:12:28 | 200 | 23.352µs | 127.0.0.1 | HEAD "/" transferring model data ⠙ [GIN] 2024/09/04 - 15:13:00 | 200 | 168.198µs | 127.0.0.1 | POST "/api/blobs/sha256:xxxxxxx" [GIN] 2024/09/04 - 15:13:00 | 200 | 5.022104ms | 127.0.0.1 | POST "/api/create" transferring model data 100% converting model Error: proto: cannot parse invalid wire-format data ``` ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.3.6
GiteaMirror added the bug label 2026-05-04 00:50:09 -05:00
Author
Owner

@YueChenkkk commented on GitHub (Sep 4, 2024):

I've tried to first convert the hf model checkpoint into a gguf file in bf16 and ollama create again.

This time I hit the following error:

usr-yc@lm-machine:~/models/vanilla-llama-3.1-8b-gguf$ ollama create my-llama-model
[GIN] 2024/09/04 - 16:35:30 | 200 |      32.033µs |       127.0.0.1 | HEAD     "/"
transferring model data 99% ⠼ [GIN] 2024/09/04 - 16:36:15 | 201 | 28.804626423s |       127.0.0.1 | POST     "/api/blobs/xxxxxxxx"
transferring model data 100% ⠦ [GIN] 2024/09/04 - 16:36:15 | 200 |   82.992457ms |       127.0.0.1 | POST     "/api/create"
transferring model data 100%
Error: invalid file magic
<!-- gh-comment-id:2328285909 --> @YueChenkkk commented on GitHub (Sep 4, 2024): I've tried to first convert the hf model checkpoint into a gguf file in bf16 and `ollama create` again. This time I hit the following error: ``` usr-yc@lm-machine:~/models/vanilla-llama-3.1-8b-gguf$ ollama create my-llama-model [GIN] 2024/09/04 - 16:35:30 | 200 | 32.033µs | 127.0.0.1 | HEAD "/" transferring model data 99% ⠼ [GIN] 2024/09/04 - 16:36:15 | 201 | 28.804626423s | 127.0.0.1 | POST "/api/blobs/xxxxxxxx" transferring model data 100% ⠦ [GIN] 2024/09/04 - 16:36:15 | 200 | 82.992457ms | 127.0.0.1 | POST "/api/create" transferring model data 100% Error: invalid file magic ```
Author
Owner

@pdevine commented on GitHub (Sep 10, 2024):

Hey @YueChenkkk There's a bug here where Meta includes two copies of the weights, one in safetensors format and one in pytorch format which is sitting in the directory called original/. As a workaround for now, if you remove the original/ directory it should work.

The second error you got when trying to convert w/ llama.cpp's scripts is due to an invalid conversion. That one will be harder to debug.

<!-- gh-comment-id:2339438185 --> @pdevine commented on GitHub (Sep 10, 2024): Hey @YueChenkkk There's a bug here where Meta includes two copies of the weights, one in _safetensors_ format and one in _pytorch_ format which is sitting in the directory called `original/`. As a workaround for now, if you remove the `original/` directory it should work. The second error you got when trying to convert w/ llama.cpp's scripts is due to an invalid conversion. That one will be harder to debug.
Author
Owner

@YueChenkkk commented on GitHub (Sep 10, 2024):

Hey @YueChenkkk There's a bug here where Meta includes two copies of the weights, one in safetensors format and one in pytorch format which is sitting in the directory called original/. As a workaround for now, if you remove the original/ directory it should work.

The second error you got when trying to convert w/ llama.cpp's scripts is due to an invalid conversion. That one will be harder to debug.

Thank you so much for the reply!

<!-- gh-comment-id:2339627619 --> @YueChenkkk commented on GitHub (Sep 10, 2024): > Hey @YueChenkkk There's a bug here where Meta includes two copies of the weights, one in _safetensors_ format and one in _pytorch_ format which is sitting in the directory called `original/`. As a workaround for now, if you remove the `original/` directory it should work. > > The second error you got when trying to convert w/ llama.cpp's scripts is due to an invalid conversion. That one will be harder to debug. Thank you so much for the reply!
Author
Owner

@pdevine commented on GitHub (Sep 10, 2024):

@YueChenkkk this should be fixed as of 0.3.7. You'll need to update ollama and you can check ollama --version to make sure the the client is at least at 0.3.7 (but preferably just upgrade everything to 0.3.10 which is the current latest version).

<!-- gh-comment-id:2341755968 --> @pdevine commented on GitHub (Sep 10, 2024): @YueChenkkk this should be fixed as of `0.3.7`. You'll need to update ollama and you can check `ollama --version` to make sure the the _client_ is at least at `0.3.7` (but preferably just upgrade everything to `0.3.10` which is the current latest version).
Author
Owner

@samuelvisser commented on GitHub (Mar 24, 2025):

I have this exact same issue with ollama version 0.6.2 and llama model 3.2-3b:
2025-03-24T18:54:02.935992515Z Error: proto: cannot parse invalid wire-format data

Deleting the original folder fixed the problem like suggested (but it means the bug isnt fixed..)

<!-- gh-comment-id:2749121680 --> @samuelvisser commented on GitHub (Mar 24, 2025): I have this exact same issue with ollama version 0.6.2 and llama model 3.2-3b: `2025-03-24T18:54:02.935992515Z Error: proto: cannot parse invalid wire-format data` Deleting the original folder fixed the problem like suggested (but it means the bug isnt fixed..)
Author
Owner

@pdevine commented on GitHub (Mar 28, 2025):

I think it "unfixed" itself because of the BERT model converter.

<!-- gh-comment-id:2762392715 --> @pdevine commented on GitHub (Mar 28, 2025): I think it "unfixed" itself because of the BERT model converter.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66209