[GH-ISSUE #5429] Support converting Starcoder2ForCausalLM from Safetensors #49909

Open
opened 2026-04-28 13:23:07 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @yaoyasong on GitHub (Jul 2, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5429

What is the issue?

Failed to create starcoder2 model from Modelfile:

Error: Models based on 'Starcoder2ForCausalLM' are not yet supported

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @yaoyasong on GitHub (Jul 2, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5429 ### What is the issue? Failed to create starcoder2 model from Modelfile: Error: Models based on 'Starcoder2ForCausalLM' are not yet supported ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the feature request label 2026-04-28 13:23:07 -05:00
Author
Owner

@igorschlum commented on GitHub (Jul 2, 2024):

Hi @yaoyasong, can you describe the process you are using for importing this model.

Is it from here?
https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2ForCausalLM

<!-- gh-comment-id:2202614567 --> @igorschlum commented on GitHub (Jul 2, 2024): Hi @yaoyasong, can you describe the process you are using for importing this model. Is it from here? https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2ForCausalLM
Author
Owner

@rick-github commented on GitHub (Jul 2, 2024):

What version of ollama are you using? starcoder2 models need ollama version 0.1.28 or better.

<!-- gh-comment-id:2204288366 --> @rick-github commented on GitHub (Jul 2, 2024): What version of ollama are you using? starcoder2 models need ollama version 0.1.28 or better.
Author
Owner

@geedmo commented on GitHub (Jul 3, 2024):

Similar issue here, trying to import from HF HuggingFaceH4/starchat2-15b-v0.1 (safetensors)
ollama version is 0.1.47

transferring model data
unpacking model metadata
Error: Models based on 'Starcoder2ForCausalLM' are not yet supported
<!-- gh-comment-id:2204895928 --> @geedmo commented on GitHub (Jul 3, 2024): Similar issue here, trying to import from HF HuggingFaceH4/starchat2-15b-v0.1 (safetensors) ollama version is 0.1.47 ``` transferring model data unpacking model metadata Error: Models based on 'Starcoder2ForCausalLM' are not yet supported ```
Author
Owner

@yaoyasong commented on GitHub (Jul 3, 2024):

Hi @yaoyasong, can you describe the process you are using for importing this model.

Is it from here? https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2ForCausalLM

I downloaded the model from hf (https://huggingface.co/bigcode/starcoder2-3b) and imported it directly via modelfile
Should I convert the model to gguf format first?

Modelfile:

FROM /path_to_hf_model
TEMPLATE {{ .Prompt }}

ollama version is 0.1.44

<!-- gh-comment-id:2204920007 --> @yaoyasong commented on GitHub (Jul 3, 2024): > Hi @yaoyasong, can you describe the process you are using for importing this model. > > Is it from here? https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2ForCausalLM I downloaded the model from hf (https://huggingface.co/bigcode/starcoder2-3b) and imported it directly via modelfile Should I convert the model to gguf format first? Modelfile: FROM /path_to_hf_model TEMPLATE {{ .Prompt }} ollama version is 0.1.44
Author
Owner

@pdevine commented on GitHub (Jul 3, 2024):

Unfortunately Ollama can't (yet) convert directly from the safetensors for starcoder2 (unlike for llama3/gemma), but you should be able to use the convert-hf-to-gguf.py script in thellm/llama.cpp/ directory. Convert the model over to a gguf bin file and then include that in the FROM line of your model file.

<!-- gh-comment-id:2207412565 --> @pdevine commented on GitHub (Jul 3, 2024): Unfortunately Ollama can't (yet) convert directly from the safetensors for starcoder2 (unlike for llama3/gemma), but you should be able to use the `convert-hf-to-gguf.py` script in the`llm/llama.cpp/` directory. Convert the model over to a gguf bin file and then include that in the `FROM` line of your model file.
Author
Owner

@pdevine commented on GitHub (Jul 3, 2024):

If you want to use starcoder2 without having to convert it, just use ollama run starcoder2 of course.

<!-- gh-comment-id:2207413642 --> @pdevine commented on GitHub (Jul 3, 2024): If you want to use starcoder2 without having to convert it, just use `ollama run starcoder2` of course.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49909