Skip to content

Unsloth: config.json does not exist inside Gemma-3 #2098

Closed

Description

@JdoubleU2

Im having problems saving GGUFs of Gemma 3 finetunes. I was having this problem on my container environment and assumed I was having issues while training that caused other files to be generated but I am not. I have an almost identical Jypiter notebook as the one on the blog, yet I still cannot get model.save_pretrained_gguf() to run successfully with Gemma 3 models. In fact, it doesn't even work on the current version of the notebooks on the blog!

https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma3_(4B).ipynb#scrollTo=FqfebeAdT073

Image

I have tried multiple methods of generating the config.json files

model.save_pretrained("Careconnect-gemma-3-4b-it")
tokenizer.save_pretrained("Careconnect-gemma-3-4b-it")
model.config.save_pretrained("Careconnect-gemma-3-4b-it")  # Try to ensure config is saved config is saved

from transformers import AutoConfig
# Force auto generate because model.config.save_pretrained() isn't working
config = AutoConfig.from_pretrained("Careconnect-gemma-3-4b-it") 
config.save_pretrained("Careconnect-gemma-3-4b-it")

Doing this, I was able to generate a config.json. However, an issue which I believe stems from limitations to external internet access on my container, still will be unable to run the model.save_pretrained_gguf(). Supposedly due to internet access, possibly not related to the config issue.

Unsloth: Updating system package directories  
Unsloth: Install GGUF and other packages
RuntimeError: Unsloth: Could not obtain https://github.com/ggerganov/llama.cpp/raw/refs/heads/master/convert_hf_to_gguf.py. Maybe you don't have internet ocnnection?
Traceback:
File "Cell [cell17]", line 1, in <module>
    model.save_pretrained_gguf(
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/unsloth/save.py", line 2246, in save_to_gguf_generic
    metadata = _convert_to_gguf(
File "/opt/conda/lib/python3.10/site-packages/unsloth_zoo/llama_cpp.py", line 653, in convert_to_gguf
    conversion_filename, supported_types = _download_convert_hf_to_gguf()
File "/opt/conda/lib/python3.10/site-packages/unsloth_zoo/llama_cpp.py", line 353, in _download_convert_hf_to_gguf
    raise RuntimeError(

As a work around I simply run the llama.cpp convert_hf_to_gguf.py python script and get this output.

python convert_hf_to_gguf.py Careconnect-gemma-3-4b-it --outtype q8_0 --outfile ./gguf_model


INFO:hf-to-gguf:Loading model: Careconnect-gemma-3-4b-it  
INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only  
INFO:hf-to-gguf:Has vision encoder, but it will be ignored  
INFO:hf-to-gguf:Exporting model...  
INFO:hf-to-gguf:Set meta model  
INFO:hf-to-gguf:Set model parameters  
INFO:hf-to-gguf:Set model tokenizer
INFO:gguf.vocab:Setting special token type bos to 2  
INFO:gguf.vocab:Setting special token type eos to 106  
INFO:gguf.vocab:Setting special token type unk to 3  
INFO:gguf.vocab:Setting special token type pad to 0  
INFO:gguf.vocab:Setting add_bos_token to True  
INFO:gguf.vocab:Setting add_eos_token to False  
INFO:gguf.vocab:Setting chat_template to {{ bos_token }}  
{%- if messages[0]['role'] == 'system' -%}  
    {%- if messages[0]['content'] is string -%}  
        {%- set first_user_prefix = messages[0]['content'] + '  

' -%}  
    {%- else -%}  
        {%- set first_user_prefix = messages[0]['content'][0]['text'] + '  

' -%}  
    {%- endif -%}  
    {%- set loop_messages = messages[1:] -%}  
{%- else -%}  
    {%- set first_user_prefix = "" -%}  
    {%- set loop_messages = messages -%}  
{%- endif -%}  
{%- for message in loop_messages -%}  
    {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}  
        {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}  
    {%- endif -%}  
    {%- if (message['role'] == 'assistant') -%}  
        {%- set role = "model" -%}  
    {%- else -%}  
        {%- set role = message['role'] -%}  
    {%- endif -%}  
    {{ '<start_of_turn>' + role + '  
' + (first_user_prefix if loop.first else "") }}  
    {%- if message['content'] is string -%}  
        {{ message['content'] | trim }}  
    {%- elif message['content'] is iterable -%}  
        {%- for item in message['content'] -%}  
            {%- if item['type'] == 'image' -%}  
                {{ '<start_of_image>' }}  
            {%- elif item['type'] == 'text' -%}  
                {{ item['text'] | trim }}  
            {%- endif -%}  
        {%- endfor -%}  
    {%- else -%}  
        {{ raise_exception("Invalid content type") }}  
    {%- endif -%}  
    {{ '<end_of_turn>  
' }}  
{%- endfor -%}  
{%- if add_generation_prompt -%}  
    {{'<start_of_turn>model  
'}}  
{%- endif -%}  

INFO:hf-to-gguf:Set model quantization version  
INFO:gguf.gguf_writer:Writing the following files:  
INFO:gguf.gguf_writer:gguf_model: n_tensors = 0, total_size = negligible - metadata only
Writing: 0.00byte [00:00, ?byte/s]  
INFO:hf-to-gguf:NOTE: this script only convert the language model to GGUF  
INFO:hf-to-gguf:      for the vision model, please use gemma3_convert_encoder_to_gguf.py  
INFO:hf-to-gguf:Model successfully exported to gguf_model

Writing 0.00bytes? 0:00 seconds? This cannot be right! The generated .gguf file is also only 6.3MB!

-rw-r--r--. 1 root root 6.3M Mar 19 01:54 /home/app/Careconnect-gemma-3-4b-it.gguf

This could be a problem with llama.cpp Gemma 3 GGUF and not Unsloth. But considering the issue is even appearing on the Colab Notebooks I believe this issue should be looked into by more people / devs. I see that Unsloth does have Hugging Face repositories with the GGUF files, so there should be a workaround.

Activity

  1. l-lorne-n commented on Mar 19, 2025

    @l-lorne-n

    same problem!

  2. eljanmahammadli commented on Mar 19, 2025

    @eljanmahammadli

    Facing the same issue. Even after I create config.json manually I am getting the following error:

    ---------------------------------------------------------------------------
    AssertionError                            Traceback (most recent call last)
    Cell In[61], line 2
          1 if True: # Change to True to upload GGUF
    ----> 2     model.push_to_hub_gguf(
          3         "checkpoints/gemma-3-4b-128r",
          4         quantization_type = "Q8_0", # Only Q8_0, BF16, F16 supported
          5         repo_id = "polygraf-ai/gemma-3-4b-128r-gguf",
          6     )
    
    File /opt/conda/envs/gemma/lib/python3.11/site-packages/torch/utils/_contextlib.py:116, in context_decorator.<locals>.decorate_context(*args, **kwargs)
        113 @functools.wraps(func)
        114 def decorate_context(*args, **kwargs):
        115     with ctx_factory():
    --> 116         return func(*args, **kwargs)
    
    File /opt/conda/envs/gemma/lib/python3.11/site-packages/unsloth/save.py:2246, in save_to_gguf_generic(model, save_directory, quantization_type, repo_id, token)
       2243     install_llama_cpp(just_clone_repo = True)
       2244 pass
    -> 2246 metadata = _convert_to_gguf(
       2247     save_directory,
       2248     print_output = True,
       2249     quantization_type = quantization_type,
       2250 )
       2251 if repo_id is not None:
       2252     prepare_saving(
       2253         model,
       2254         repo_id,
       (...)   2258         token = token,
       2259     )
    
    File /opt/conda/envs/gemma/lib/python3.11/site-packages/unsloth_zoo/llama_cpp.py:656, in convert_to_gguf(input_folder, output_filename, quantization_type, max_shard_size, print_output, print_outputs)
        653 conversion_filename, supported_types = _download_convert_hf_to_gguf()
        655 # Check if arch is supported
    --> 656 assert("architectures") in config_file
        657 arch = config_file["architectures"][0]
        658 if arch not in supported_types:
    
    AssertionError: 
    
  3. JdoubleU2 commented on Mar 19, 2025

    @JdoubleU2
    Author

    Yeah, it doesn't seem like the config file gets generated correctly with gemma3. Hope they can fix this soon

  4. l-lorne-n commented on Mar 21, 2025

    @l-lorne-n

    hey,guys! I think i might find the answer:
    try: merged_model = model.merge_and_unload() #after(trainer_stats = trainer.train())
    then: merged_model.save_pretrained("the position you want to preserve")
    tokenizer.save_pretrained("the position you want to preserve")
    after that ,config.json will exist
    finally: model.save_pretrained_gguf(
    "the position you want to preserve",
    quantization_type = "Q8_0",
    )

  5. danielhanchen commented on Mar 22, 2025

    @danielhanchen
    Member

    Let me investigate the issue - apologies on the error!

  6. jonmorton commented on Mar 23, 2025

    @jonmorton

    Has anyone figured this one out? I can't get gguf export of gemma3 or phi-4 models to work.

  7. sanshaoyeyang commented on Mar 25, 2025

    @sanshaoyeyang

    Let me investigate the issue - apologies on the error!

    fix it pls

  8. stathamos commented on Mar 25, 2025

    @stathamos

    Facing the same issue. Cannot generate gguf from Gemma 3 finetuning.

  9. hcstubbe commented on Mar 30, 2025

    @hcstubbe

    Has anyone figured this one out? I can't get gguf export of gemma3 or phi-4 models to work.

    Try different quantizations: I find, that for gemma-3-27b-it-unsloth-bnb-4bit gguf can be created using BF16 and F16, but not Q8_0. For the 1bit and 27 bit models, all three currently supported quantizations ("Q8_0", "BF16", and "F16") work.
    I run this in a docker container (here is the docker file for the respective image) with an h100.

  10. shimmyshimmer commented on Apr 2, 2025

    @shimmyshimmer
    Member

    @JuanMao-CuSO4 @rust17 just moving the conversation here thank you :)

  11. pooja-singh-scm commented on Apr 3, 2025

    @pooja-singh-scm

    I used an additional save_pretrained_merged function call as a workaround. It creates the config.json correctly, and the subsequent gguf creation goes through.

    model.save_pretrained_merged("gemma-3-finetune", tokenizer)

    model.save_pretrained_gguf(
    "gemma-3-finetune",
    quantization_type = "Q8_0",
    )

  12. Jordinia commented on May 12, 2025

    @Jordinia

    I have the same issue. Not using Gemma but this I found other issues but got referenced to this thread. I have finished training Qwen3 4B and Llama 3.2 3B but I have not found a way to export to GGUF. I don't know if its my skill issue but I tried on almost everything it does not work.

    Hardware config I have tried out:

    • Arch Linux (3090Ti)
    • Ubuntu (4090)
    • Windows & WSL (3090)

    When I run model.save_pretrained_gguf here is the error I got (on Windows, different error on WSL Ubuntu and Arch):

    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    Cell In[3], line 1
    ----> 1 model.save_pretrained_gguf(
          2     "model/netpro-qwen3-0505-fp16-gguf",
          3     tokenizer,
          4     quantization_method = "f16",  # or "q4_k_m" for quantization
          5 )
    
    File c:\Users\rizky\.conda\envs\unsloth\Lib\site-packages\unsloth\save.py:1806, in unsloth_save_pretrained_gguf(self, save_directory, tokenizer, quantization_method, first_conversion, push_to_hub, token, private, is_main_process, state_dict, save_function, max_shard_size, safe_serialization, variant, save_peft_format, tags, temporary_location, maximum_memory_usage)
       1804 python_install = install_python_non_blocking(["gguf", "protobuf"])
       1805 git_clone.wait()
    -> 1806 makefile = install_llama_cpp_make_non_blocking()
       1807 new_save_directory, old_username = unsloth_save_model(**arguments)
       1808 python_install.wait()
    
    File c:\Users\rizky\.conda\envs\unsloth\Lib\site-packages\unsloth\save.py:786, in install_llama_cpp_make_non_blocking()
        784 check = os.system("cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON")
        785 if check != 0:
    --> 786     raise RuntimeError(f"*** Unsloth: Failed compiling llama.cpp using os.system(...) with error {check}. Please report this ASAP!")
        787 pass
        788 # f"cmake --build llama.cpp/build --config Release -j{psutil.cpu_count()*2} --clean-first --target {' '.join(LLAMA_CPP_TARGETS)}",
    
    RuntimeError: *** Unsloth: Failed compiling llama.cpp using os.system(...) with error 1. Please report this ASAP!
    

    I did able to export lora adapter using

    model.save_pretrained(config.get('lora_model', 'outputs'))
    tokenizer.save_pretrained(config.get('lora_model', 'outputs'))
    

    and I can reload it consistently using this code:

    from unsloth import FastLanguageModel
    from peft import PeftModel
    import torch
    import re
    import json
    
    model, tokenizer = FastLanguageModel.from_pretrained(
        model_name = "unsloth/Qwen3-4B-unsloth-bnb-4bit",  # Must match training
        max_seq_length = 30000, 
        load_in_4bit = True,   
        device_map = "auto",
    )
    
    model = PeftModel.from_pretrained(
        model,
        model_id = "model/netpro-qwen3-0505-lora",
        adapter_name = "web_classifier",
        is_trainable = False,  # Crucial for inference
    )
    
    # 3. Merge and optimize (reduces VRAM by ~30%)
    model = model.merge_and_unload()
    

    and if I want to inference, I can just call model = FastLanguageModel.for_inference(model) and try inference as usual.

    The problem comes when I try to convert to GGUF to test it on Ollama. model.save_pretrained_gguf("dir", tokenizer, quantization_method = "f16") does not work anywhere I tried, and I'm unable to replicate it in Google Colab since the default Nvidia T4 does not support BF16. I do follow the tutorial to manually save GGUF by using llama.cpp (building llama.cpp is horrible) but I managed to run something like this:

    model.save_pretrained_merged("model/netpro-qwen3-0505-fp16-hf", tokenizer, save_method = "merged_16bit",)
    !python "C:\Users\user\Documents\Projects\llama.cpp\convert_hf_to_gguf.py" model\netpro-qwen3-0505-fp16-hf --outfile qwen3-0505-fp16.gguf --outtype f16
    

    I tried loading it to Ollama and running directly on llama.cpp but the result is bad, and I think the model corrupted in the process of either saving to hf or converting to GGUF. I don't know what configuration I'm missing or since I'm training with 4bit should I change the save_method or quantization I'm also not sure. Any help would be much appreciated.🙏

  13. hcstubbe commented on May 13, 2025

    @hcstubbe

    RuntimeError Traceback (most recent call last)
    Cell In[3], line 1
    ----> 1 model.save_pretrained_gguf(
    2 "model/netpro-qwen3-0505-fp16-gguf",
    3 tokenizer,
    4 quantization_method = "f16", # or "q4_k_m" for quantization
    5 )

    File c:\Users\rizky.conda\envs\unsloth\Lib\site-packages\unsloth\save.py:1806, in unsloth_save_pretrained_gguf(self, save_directory, tokenizer, quantization_method, first_conversion, push_to_hub, token, private, is_main_process, state_dict, save_function, max_shard_size, safe_serialization, variant, save_peft_format, tags, temporary_location, maximum_memory_usage)
    1804 python_install = install_python_non_blocking(["gguf", "protobuf"])
    1805 git_clone.wait()
    -> 1806 makefile = install_llama_cpp_make_non_blocking()
    1807 new_save_directory, old_username = unsloth_save_model(**arguments)
    1808 python_install.wait()

    File c:\Users\rizky.conda\envs\unsloth\Lib\site-packages\unsloth\save.py:786, in install_llama_cpp_make_non_blocking()
    784 check = os.system("cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON")
    785 if check != 0:
    --> 786 raise RuntimeError(f"*** Unsloth: Failed compiling llama.cpp using os.system(...) with error {check}. Please report this ASAP!")
    787 pass
    788 # f"cmake --build llama.cpp/build --config Release -j{psutil.cpu_count()*2} --clean-first --target {' '.join(LLAMA_CPP_TARGETS)}",

    RuntimeError: *** Unsloth: Failed compiling llama.cpp using os.system(...) with error 1. Please report this ASAP!

    ---------------------------------------------------------------------------
    

    Your error message states that compiling llama.cpp using unsloth fails. You should get the llama.cpp repo, locate it in the folder where you execute your unsloth python code (same working directory) and compile llama.cpp there.

    In ubuntu (e.g. WSL) with CUDA support you can do that like this:

        git clone https://github.com/ggerganov/llama.cpp && \
        cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=ON -DGGML_CUDA=ON -DLLAMA_CURL=ON && \
        cmake --build llama.cpp/build --config Release -j --clean-first --target llama-quantize llama-cli llama-gguf-split && \
        cp llama.cpp/build/bin/llama-* ./llama.cpp/
    

    P.S.: I use a docker image with these install instructions and converting Qwen3 to gguf works.

  14. jonmorton commented on Jun 4, 2025

    @jonmorton

    One problem is that there are two different gguf export functions, and if there is no "config" property in the model, only the generic one is used. The generic one doesn't create a ollama Modelfile, etc.

    unsloth/unsloth/save.py

    Lines 2524 to 2540 in 6ebef50

    if not vision:
    if hasattr(model, "config"):
    # Counteract tokenizers
    model.push_to_hub_merged = types.MethodType(unsloth_generic_push_to_hub_merged, model)
    model.save_pretrained_merged = types.MethodType(unsloth_generic_save_pretrained_merged, model)
    model.push_to_hub_gguf = types.MethodType(unsloth_push_to_hub_gguf, model)
    model.save_pretrained_gguf = types.MethodType(unsloth_save_pretrained_gguf, model)
    model.push_to_hub_ggml = types.MethodType(unsloth_convert_lora_to_ggml_and_push_to_hub, model)
    model.save_pretrained_ggml = types.MethodType(unsloth_convert_lora_to_ggml_and_save_locally, model)
    pass
    else:
    # Vision only 1 option
    model.push_to_hub_merged = types.MethodType(unsloth_generic_push_to_hub_merged, model)
    model.save_pretrained_merged = types.MethodType(unsloth_generic_save_pretrained_merged, model)
    model.push_to_hub_gguf = types.MethodType(save_to_gguf_generic, model)
    model.save_pretrained_gguf = types.MethodType(save_to_gguf_generic, model)
    pass

    How does this config property get created? Why doesn't it exist for qwen2.5 coder for example?

  15. jonmorton commented on Jun 4, 2025

    @jonmorton

    Actually, I found the issue for me at least - if you are loading in 8bit or doing full fine tuning, FastLanguageModel.from_pretrained is redirected to FastModel.from_pretrained which uses FastBaseModel.from_pretrained. FastBaseModel is in vision.py and assumes the model is a vision model, so the unsloth specific functions are not used.

    As it turns out, I never get errors about config.json when using the unsloth export method.

  16. rolandtannous commented on Jun 30, 2025

    @rolandtannous
    Contributor

    Hello ,

    The save_pretrained_merged method has been updated and fixed.
    Please make sure to upgrade your installation to the latest version using

    pip install --upgrade unsloth-zoo
    pip install --upgrade unsloth
    

    Will close this for now.
    Please feel free to comment back if you are still facing the same issue after trying the above.
    Thank you for using Unsloth

  17. crisdesivo commented on Jul 21, 2025

    @crisdesivo

    I am having the same issue with Qwen3 1.7b

  18. thewh1teagle commented on Sep 30, 2025

    @thewh1teagle

    I experience the same issue with gemma3-270m

    """
    uv run src/export_gguf.py --model_path ./outputs/checkpoint-7500
    """
    from unsloth import FastModel
    from unsloth.chat_templates import get_chat_template
    from transformers import TextStreamer
    import torch
    import argparse
    from pathlib import Path
    
    parser = argparse.ArgumentParser()
    parser.add_argument("--model_path", type=str, default="./outputs/checkpoint-7500")
    parser.add_argument("--output_path", type=str, default="./model_gguf")
    args = parser.parse_args()
    
    Path(args.output_path).mkdir(parents=True, exist_ok=True)
    
    
    # Load model & tokenizer
    model, tokenizer = FastModel.from_pretrained(
        model_name = args.model_path,  # local saved folder
        load_in_4bit = False,
        load_in_8bit = False,
    )
    model.merge_and_unload()
    model.save_pretrained('gemma-3')
    tokenizer.save_pretrained('gemma-3')
    
    tokenizer = get_chat_template(tokenizer, chat_template="gemma3")
    model.save_pretrained_gguf('gemma-3', tokenizer)
  19. Vivek-RKD commented on Sep 30, 2025

    @Vivek-RKD

    Can confirm that. I tried the official finetuning notebook (link) for gemma3-270m and faced the same export issue for gguf for all quantizations (Q8_0, BF16, F16).

  20. rolandtannous commented on Sep 30, 2025

    @rolandtannous
    Contributor

    Hello,

    please note that I recently pushed a couple of PRs to solve saving to GGUF in unsloth for linux systems as well as colab and kaggle. I've just linked them up.
    They're being reviewed and should be merged this week. Will ping you all once it's done.

  21. rolandtannous commented on Oct 15, 2025

    @rolandtannous
    Contributor

    @DaAe-Lee @JacksonDescant @JdoubleU2 @Jordinia @OmarJ9 @Shrijeeth @TheSittingCat @Vivek-RKD @a-chris @andresgr96 @crisdesivo @eljanmahammadli @epie-godfred @fabiochiusano @frikishaan @fungiboletus @hcstubbe @jonmorton @l-lorne-n @plkumar @pooja-singh-scm @robert-bor @sanshaoyeyang @stathamos @stevechk @thash-ai @thewh1teagle @vinhnx @younik

    @C-rypto

    We just pushed a major fix for llamacpp integration.

    1- Please make sure to update your local install of unsloth

    pip install --force-reinstall --no-deps unsloth-zoo unsloth
    

    If you're using a notebook on kaggle or colab, it should pull the latest version automatically.

    2- You can now use save_pretrained_gguf to quantize and save to GGUF format:

    model.save_pretrained_gguf(
                save_directory,
                tokenizer=tokenizer,
                quantization_method=quantization_method,
            )
    

    For vision/multimodal models, use tokenizer=processor

    3- You can pass it one or several quant methods (as a list):

    quantization_method = "q8_0"
    

    or

    quantization_method = ["q8_0", "q4_k_m"]
    

    We support all the quants mentioned in this page except the iq variants.

    4- If the model is supported by Ollama, it will now also automatically create a Modelfile for you that you can use to create your model in ollama using:

    ollama create model_name -f ./Modelfile
    

    5- Use push_to_hub_gguf if you want to convert to gguf and push to Huggingface Hub instead.

    6- Should work for all models supported by unsloth and ollama.

    7- It now fully supports linux debian and RPM variants. We are still testing windows (if someone has a windows machine and is on our discord channel ping me to help debug)

    Thanks!

  22. thewh1teagle commented on Oct 19, 2025

    @thewh1teagle

    @rolandtannous
    Thanks for the update! I just tried now to export the model to GGUF, and it does create the Modelfile now, but it lacks the chat template / system prompt, it just have basic Modelfile without the pre configured prompt.

    Details
    FROM gemma-3-270m-it.Q8_0.gguf
    TEMPLATE """{{- $systemPromptAdded := false }}
    {{- range $i, $_ := .Messages }}
    {{- $last := eq (len (slice $.Messages $i)) 1 }}
    {{- if eq .Role "user" }}<start_of_turn>user
    {{- if (and (not $systemPromptAdded) $.System) }}
    {{- $systemPromptAdded = true }}
    {{ $.System }}
    {{ end }}
    {{ .Content }}<end_of_turn>
    {{ if $last }}<start_of_turn>model
    {{ end }}
    {{- else if eq .Role "assistant" }}<start_of_turn>model
    {{ .Content }}{{ if not $last }}<end_of_turn>
    {{ end }}
    {{- end }}
    {{- end }}
    """
    PARAMETER stop "<end_of_turn>"
    PARAMETER top_k 64
    PARAMETER top_p 0.95

    I had to manually create Modelfile like this one

    Details
    # Modelfile generated by "ollama show"
    # To build a new Modelfile based on this, replace FROM with:
    # FROM gemma3-g2p:latest
    
    FROM /Users/yqbqwlny/.ollama/models/blobs/sha256-fc913da66a5d2136c4859950513f5d253ea061b44181cf9fe946adc4422325f6
    TEMPLATE "<start_of_turn>system
    {{ .System }}<end_of_turn>
    <start_of_turn>user
    {{ .Prompt }}<end_of_turn>
    <start_of_turn>model
    "
    SYSTEM "
    Given the following Hebrew sentence, convert it to IPA phonemes.
    Input Format: A Hebrew sentence.
    Output Format: A string of IPA phonemes.
    "
    PARAMETER top_k 64
    PARAMETER top_p 0.95
    PARAMETER num_predict 150
    PARAMETER stop <end_of_turn>
    PARAMETER stop </s>
    PARAMETER temperature 0.9
  23. rolandtannous commented on Oct 23, 2025

    @rolandtannous
    Contributor

    @thewh1teagle the modelfile created by unsloth is correct and is in the ollama standard format for gemma3 .
    It originates from here: https://ollama.com/library/gemma3:270m/blobs/4b19ac7dd2fb
    Ollama uses its own format that you need to follow when writing the model file or writing a custom model file as you just did here :)

    Will be closing this for now as the original issue has been resolved. Please make sure to follow the instructions given in my last response.

    Meanwhile , please feel free to respond if you're still having any issues.

    Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions