[GH-ISSUE #2365] Unable to use safetensor fine tuned model deepseek to gguf with convert.py from llama.cpp #1371

Closed
opened 2026-04-12 11:12:16 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @JesseGuerrero on GitHub (Feb 6, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2365

Originally assigned to: @bmizerany on GitHub.

I finished fine tuning a deepseek-ai/deepseek-coder-1.3b-instruct and am now trying to convert it to gguf with llama.cpp to use with ollama.

However, none of the options with convert.py are working. I assume the model works because the inference API on hugging face works just fine for my huggingface model.

I tried all three vocab-types, including different tokenizer.model files and pad-vocab with llama.cpp.

Typically when it doesnt convert it says there is a mismatch like this on ollama...
image
When it does go through it either shows gibberish in ollama or is "failed to load model" or "Tensor size mismatch".

Any help for me to understand how to get this to convert properly would help.

Here is my fine tuned model: https://huggingface.co/JesseGuerrero/deepseekAllDarkan

I made a few fine tuned models already and they worked fine. Dunno what is going on with this one.

Btw, this is what the gibberish looks like:
image

Originally created by @JesseGuerrero on GitHub (Feb 6, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2365 Originally assigned to: @bmizerany on GitHub. I finished fine tuning a deepseek-ai/deepseek-coder-1.3b-instruct and am now trying to convert it to gguf with llama.cpp to use with ollama. However, none of the options with convert.py are working. I assume the model works because the inference API on hugging face works just fine for my huggingface model. I tried all three vocab-types, including different tokenizer.model files and pad-vocab with llama.cpp. Typically when it doesnt convert it says there is a mismatch like this on ollama... ![image](https://github.com/ollama/ollama/assets/27308928/679d55f8-b0bd-49a8-95cb-d73e6106a8dd) When it does go through it either shows gibberish in ollama or is "failed to load model" or "Tensor size mismatch". Any help for me to understand how to get this to convert properly would help. Here is my fine tuned model: https://huggingface.co/JesseGuerrero/deepseekAllDarkan I made a few fine tuned models already and they worked fine. Dunno what is going on with this one. Btw, this is what the gibberish looks like: ![image](https://github.com/ollama/ollama/assets/27308928/1c004afc-62f7-4afa-8053-56625bac0c17)
Author
Owner

@jukofyork commented on GitHub (Feb 6, 2024):

I has to use the --pad-vocab and --vocab-type = bpe when I used it for the deepseek-coder:33b-instruct model, but see you said you tried these so not sure what to suggest.

Possibly try turning down the temperature to 0.0 and the repeat-penalty to 1.0 as it seems to not like the default values of these.

<!-- gh-comment-id:1930948291 --> @jukofyork commented on GitHub (Feb 6, 2024): I has to use the `--pad-vocab` and `--vocab-type = bpe` when I used it for the `deepseek-coder:33b-instruct` model, but see you said you tried these so not sure what to suggest. Possibly try turning down the `temperature` to 0.0 and the `repeat-penalty` to 1.0 as it seems to not like the default values of these.
Author
Owner

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

This issue got lost in the deluge of issues, but you can alternatively just convert this directly in Ollama by putting the path to the safetensors file in the FROM line of the Modelfile. I've updated the importing doc which goes into more details. Ollama will automatically pad the vocab during ollama create.

I think we can close this.

<!-- gh-comment-id:2347281628 --> @pdevine commented on GitHub (Sep 12, 2024): This issue got lost in the deluge of issues, but you can alternatively just convert this directly in Ollama by putting the path to the safetensors file in the `FROM` line of the `Modelfile`. I've updated the [importing doc](https://github.com/ollama/ollama/blob/main/docs/import.md) which goes into more details. Ollama will automatically pad the vocab during `ollama create`. I think we can close this.
Author
Owner

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

To be clear here, this is for deepseek 1.3b which uses the llama architecture. Deepseek coder v2 uses a different architecture which you can't directly import.

<!-- gh-comment-id:2347292342 --> @pdevine commented on GitHub (Sep 12, 2024): To be clear here, this is for deepseek 1.3b which uses the llama architecture. Deepseek coder v2 uses a different architecture which you can't directly import.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1371