[GH-ISSUE #4670] llama3 8b BF16 error #2937

Closed
opened 2026-04-12 13:18:30 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @ccbadd on GitHub (May 27, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4670

What is the issue?

I downloaded the model from huggingface llama3 8b bf16 and when I run:
ollama create llama3bf16 -f Modfile
I get this output:
transferring model data
Error: invalid file magic
This is on a Win 11 PC running ollama 0.1.38 with an AMD W6800 GPU. Is the bf16 model not supported?

OS

Windows

GPU

AMD

CPU

AMD

Ollama version

0.1.38

Originally created by @ccbadd on GitHub (May 27, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4670 ### What is the issue? I downloaded the model from huggingface llama3 8b bf16 and when I run: ollama create llama3bf16 -f Modfile I get this output: transferring model data Error: invalid file magic This is on a Win 11 PC running ollama 0.1.38 with an AMD W6800 GPU. Is the bf16 model not supported? ### OS Windows ### GPU AMD ### CPU AMD ### Ollama version 0.1.38
GiteaMirror added the createneeds more infobug labels 2026-04-12 13:18:30 -05:00
Author
Owner

@pdevine commented on GitHub (May 28, 2024):

@ccbadd did you download a bf16 gguf file? What does the Modelfile look like?

Unfortunately the runner will not work w/ bf16 natively, as it has to be converted to fp16. If you downloaded the bf16 safetensors, you can however convert that directly in Ollama (just put the directory w/ the safetensors in the FROM line of your modelfile). You'll still have to get the template and the stop parameters correct which is somewhat tricky.

Alternatively you can just ollama pull llama3:8b-instruct-fp16 to download the already converted model.

<!-- gh-comment-id:2136078388 --> @pdevine commented on GitHub (May 28, 2024): @ccbadd did you download a bf16 gguf file? What does the Modelfile look like? Unfortunately the runner will _not_ work w/ bf16 natively, as it has to be converted to fp16. If you downloaded the bf16 safetensors, you _can_ however convert that directly in Ollama (just put the directory w/ the safetensors in the `FROM` line of your modelfile). You'll still have to get the template and the stop parameters correct which is somewhat tricky. Alternatively you can just `ollama pull llama3:8b-instruct-fp16` to download the already converted model.
Author
Owner

@Jbollenbacher commented on GitHub (Aug 13, 2024):

What is the limitation that stops bf16 from working?

Models like llama3.1 are trained natively in bf16, not fp16, and the difference matters. Casting from bf16 to fp16 will degrade performance. It matters less than going from fp16 to Q4, but it does clip large weights in a way that can affect inference. So if serving bf16 was possible, I think that'd be preferable for those of us who run 16bits, especially for larger models.

What would need to be done to make this possible?

<!-- gh-comment-id:2285270258 --> @Jbollenbacher commented on GitHub (Aug 13, 2024): What is the limitation that stops bf16 from working? Models like llama3.1 are trained natively in bf16, not fp16, and the difference matters. Casting from bf16 to fp16 will degrade performance. It matters less than going from fp16 to Q4, but it does clip large weights in a way that can affect inference. So if serving bf16 was possible, I think that'd be preferable for those of us who run 16bits, especially for larger models. What would need to be done to make this possible?
Author
Owner

@pdevine commented on GitHub (Aug 13, 2024):

@Jbollenbacher the GGML library didn't support bfloat16s as a datatype until recently. There is support for that now, but it still takes time to make it work everywhere.

<!-- gh-comment-id:2286768039 --> @pdevine commented on GitHub (Aug 13, 2024): @Jbollenbacher the GGML library didn't support bfloat16s as a datatype until recently. There is support for that now, but it still takes time to make it work everywhere.
Author
Owner

@Jbollenbacher commented on GitHub (Aug 13, 2024):

Great thanks. Is there an open issue tracking this?

<!-- gh-comment-id:2286835216 --> @Jbollenbacher commented on GitHub (Aug 13, 2024): Great thanks. Is there an open issue tracking this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2937