Skip to content

PreTrainedTokenizerFast has no attribute _ollama_modelfile #1729

Closed

Description

@leonlee723

I have been running "Ollama+Unsloth+Llama3+CSV finetuning.ipynb" on my local Ubuntu computer.
I had saved gguf model file on my disk.(./model)
When running "print(tokenizer._ollama_modelfile)" to create an ollama model file, show error

AttributeError: PreTrainedTokenizerFast has no attribute _ollama_modelfile

I had tracked source code and hadn't found the function. Is this a bug?

Activity

  1. danielhanchen commented on Feb 23, 2025

    @danielhanchen
    Member

    I will investigate - apologies on the delay!

  2. tomhanax commented on Apr 4, 2025

    @tomhanax

    Any progress on this, please?

  3. Zemelee commented on Apr 14, 2025

    @Zemelee

    我会调查的 - 很抱歉耽搁了!

    我也遇到了

  4. Zemelee commented on Apr 14, 2025

    @Zemelee

    I have been running "Ollama+Unsloth+Llama3+CSV finetuning.ipynb" on my local Ubuntu computer. I had saved gguf model file on my disk.(./model) When running "print(tokenizer._ollama_modelfile)" to create an ollama model file, show error

    AttributeError: PreTrainedTokenizerFast has no attribute _ollama_modelfile

    I had tracked source code and hadn't found the function. Is this a bug?

    May I ask if you have solved it?

  5. themantalope commented on Jul 31, 2025

    @themantalope

    Seems like this is broken. I would also like this feature.

  6. PangLuo commented on Aug 4, 2025

    @PangLuo

    Interesting.

    I ran Llama3_(8B)-Ollama.ipynb and there was no error with print(tokenizer._ollama_modelfile)

    Image

    I guess there may be a nuanced difference between this tokenizer and the tokenizer in the notebook you ran.

  7. PangLuo commented on Aug 4, 2025

    @PangLuo

    I just ran Ollama + Unsloth + Llama-3 + CSV finetuning.ipynb and there was no error with print(tokenizer._ollama_modelfile). Probably somebody has fixed the issue.

  8. PangLuo commented on Aug 4, 2025

    @PangLuo

    I had tracked source code and hadn't found the function. Is this a bug?

    Image
  9. rolandtannous commented on Oct 15, 2025

    @rolandtannous
    Contributor

    @PangLuo @Zemelee @krestyan @leonlee723 @manu-one @themantalope @tomhanax

    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)

    This should work now.
    let me know if it works out for you.

    Thanks!

  10. rolandtannous commented on Oct 23, 2025

    @rolandtannous
    Contributor

    Will be closing this for now as the 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