Skip to content

RuntimeError: Unsloth: The file 'llama.cpp/llama-quantize' or 'llama.cpp/quantize' does not exist #748

Closed

Description

@okoliechykwuka

The below error occured while trying to convert model to gguf format.

I noticed that quantized folder resides in llama.cpp/examples/quantize

RuntimeError: Unsloth: The file 'llama.cpp/llama-quantize' or 'llama.cpp/quantize' does not exist.
But we expect this file to exist! Maybe the llama.cpp developers changed the name?

# Save to q4_k_m GGUF
if True: model.save_pretrained_gguf("model", tokenizer, quantization_method = "q4_k_m")

Activity

  1. danielhanchen commented on Jul 10, 2024

    @danielhanchen
    Member

    Weird I just tried it in the last hour and it works

  2. scherbakovdmitri commented on Jul 10, 2024

    @scherbakovdmitri

    It looks we need to first run make on llama cpp folder manually, not sure why it stopped working in unsloth
    ggml-org/llama.cpp#8107
    if you run make command in llama.cpp folder it will work

  3. danielhanchen commented on Jul 12, 2024

    @danielhanchen
    Member

    Weird it stopped working? Hmm I shall try this in Colab and report back!

  4. Zhangy-ly commented on Jul 19, 2024

    @Zhangy-ly

    I have the same problem. Is there a solution now?

    RuntimeError: Unsloth: The file 'llama.cpp/llama-quantize' or 'llama.cpp/quantize' does not exist.
    But we expect this file to exist! Maybe the llama.cpp developers changed the name?

  5. danielhanchen commented on Jul 19, 2024

    @danielhanchen
    Member

    It should function - are you using Colab?

  6. Zhangy-ly commented on Jul 19, 2024

    @Zhangy-ly

    It should function - are you using Colab?

    Well, mine is as follows:
    NVIDIA V100
    Driver Version: 535.146.02
    CUDA Version: 12.1

    I temporarily solved this problem by rolling back llama.cpp

    cd llama.cpp
    git checkout b3345
    git submodule update --init --recursive
    make clean
    make all -j
    git log -1

  7. okoliechykwuka commented on Jul 19, 2024

    @okoliechykwuka
    Author

    @danielhanchen Yes, I am using colab, but I am still having the same error.

  8. danielhanchen commented on Jul 20, 2024

    @danielhanchen
    Member

    Wait weird I just ran it with no errors in Colab - it's best to use our updated notebooks on our Github and start a fresh

  9. Deluxer commented on Jul 28, 2024

    @Deluxer

    @Zhangy-ly That is an effective workaround.

    cd llama.cpp
    git checkout b3345
    git submodule update --init --recursive
    make clean
    make all -j
    git log -1

  10. theodufort commented on Aug 1, 2024

    @theodufort

    @Zhangy-ly That is an effective workaround.

    cd llama.cpp
    git checkout b3345
    git submodule update --init --recursive
    make clean
    make all -j
    git log -1

    To anyone having error while using those bash commands, use: ! before each command

  11. danielhanchen commented on Aug 2, 2024

    @danielhanchen
    Member

    Wait so the issue persists? Are people using Colab / Runpod?

  12. Zhangy-ly commented on Aug 2, 2024

    @Zhangy-ly

    Wait so the issue persists? Are people using Colab / Runpod?

    Hi Daniel,

    Thank you for your response.

    To clarify, the issue persists on my Ubuntu setup, although it seems to run without problems on Colab. Is there any other information you need to help diagnose the issue? plz tell me.

    Ubuntu, NVIDIA V100, Driver Version: 535.146.02, CUDA Version: 12.1

    packages in environment:

    Name Version

    _libgcc_mutex 0.1
    _openmp_mutex 5.1
    accelerate 0.32.1
    aiohttp 3.9.5
    aiosignal 1.3.1
    async-timeout 4.0.3
    attrs 23.2.0
    bitsandbytes 0.43.2
    blas 1.0
    brotli-python 1.0.9
    bzip2 1.0.8
    ca-certificates 2024.3.11
    certifi 2024.7.4
    charset-normalizer 2.0.4
    cuda-cudart 12.1.105
    cuda-cupti 12.1.105
    cuda-libraries 12.1.0
    cuda-nvrtc 12.1.105
    cuda-nvtx 12.1.105
    cuda-opencl 12.5.39
    cuda-runtime 12.1.0
    cuda-version 12.5
    datasets 2.20.0
    dill 0.3.8
    docstring-parser 0.16
    ffmpeg 4.3
    filelock 3.13.1
    freetype 2.12.1
    frozenlist 1.4.1
    fsspec 2024.2.0
    gguf 0.9.1
    gmp 6.2.1
    gmpy2 2.1.2
    gnutls 3.6.15
    huggingface-hub 0.23.4
    idna 3.7
    intel-openmp 2023.1.0
    jinja2 3.1.3
    jpeg 9e
    lame 3.100
    lcms2 2.12
    ld_impl_linux-64 2.38
    lerc 3.0
    libcublas 12.1.0.26
    libcufft 11.0.2.4
    libcufile 1.10.1.7
    libcurand 10.3.6.82
    libcusolver 11.4.4.55
    libcusparse 12.0.2.55
    libdeflate 1.17
    libffi 3.4.4
    libgcc-ng 11.2.0
    libgomp 11.2.0
    libiconv 1.16
    libidn2 2.3.4
    libjpeg-turbo 2.0.0
    libnpp 12.0.2.50
    libnvjitlink 12.1.105
    libnvjpeg 12.1.1.14
    libpng 1.6.39
    libstdcxx-ng 11.2.0
    libtasn1 4.19.0
    libtiff 4.5.1
    libunistring 0.9.10
    libuuid 1.41.5
    libwebp-base 1.3.2
    llvm-openmp 14.0.6
    lz4-c 1.9.4
    markdown-it-py 3.0.0
    markupsafe 2.1.5
    mdurl 0.1.2
    mkl 2023.1.0
    mkl-service 2.4.0
    mkl_fft 1.3.8
    mkl_random 1.2.4
    mpc 1.1.0
    mpfr 4.0.2
    mpmath 1.3.0
    multidict 6.0.5
    multiprocess 0.70.16
    ncurses 6.4
    nettle 3.7.3
    networkx 3.2.1
    numpy 1.26.4
    numpy-base 1.26.4
    nvidia-cublas-cu12 12.1.3.1
    nvidia-cuda-cupti-cu12 12.1.105
    nvidia-cuda-nvrtc-cu12 12.1.105
    nvidia-cuda-runtime-cu12 12.1.105
    nvidia-cudnn-cu12 8.9.2.26
    nvidia-cufft-cu12 11.0.2.54
    nvidia-curand-cu12 10.3.2.106
    nvidia-cusolver-cu12 11.4.5.107
    nvidia-cusparse-cu12 12.1.0.106
    nvidia-nccl-cu12 2.19.3
    nvidia-nvjitlink-cu12 12.1.105
    nvidia-nvtx-cu12 12.1.105
    openh264 2.1.1
    openjpeg 2.4.0
    openssl 3.0.14
    packaging 24.1
    pandas 2.2.2
    peft 0.11.1
    pillow 10.3.0
    pip 24.0
    protobuf 3.20.3
    psutil 6.0.0
    pyarrow 16.1.0
    pyarrow-hotfix 0.6
    pygments 2.18.0
    pysocks 1.7.1
    python 3.10.13
    python-dateutil 2.9.0.post0
    pytorch-cuda 12.1
    pytorch-mutex 1.0
    pytz 2024.1
    pyyaml 6.0.1
    readline 8.2
    regex 2024.5.15
    requests 2.32.2
    rich 13.7.1
    safetensors 0.4.3
    sentencepiece 0.2.0
    setuptools 69.5.1
    shtab 1.7.1
    six 1.16.0
    sqlite 3.45.3
    sympy 1.12
    tbb 2021.8.0
    tk 8.6.14
    tokenizers 0.19.1
    torch 2.2.0+cu121
    torchaudio 2.2.0
    torchvision 0.17.0
    tqdm 4.66.4
    transformers 4.43.1
    triton 2.2.0
    trl 0.8.6
    typing-extensions 4.9.0
    tyro 0.8.5
    tzdata 2024.1
    unsloth 2024.7
    urllib3 2.2.2
    wheel 0.43.0
    xformers 0.0.24
    xxhash 3.4.1
    xz 5.4.6
    yaml 0.2.5
    yarl 1.9.4
    zlib 1.2.13
    zstd 1.5.5

  13. jeehunseo commented on Aug 7, 2024

    @jeehunseo

    @Zhangy-ly That is an effective workaround.

    cd llama.cpp
    git checkout b3345
    git submodule update --init --recursive
    make clean
    make all -j
    git log -1

    solved my situation. There are no llama-quantize and quantize file in the newest git source(08/07/2024). So, unslothai should install the specific version of llama.cpp to fix this issue. Thank you! ;)

  14. thyarles commented on Aug 13, 2024

    @thyarles

    It looks we need to first run make on llama cpp folder manually, not sure why it stopped working in unsloth ggerganov/llama.cpp#8107 if you run make command in llama.cpp folder it will work

    Same problem here. This tip solved the issue.

    $ cd llama.cpp
    make
    
  15. 14 remaining items

  16. hwpoison commented on Dec 25, 2024

    @hwpoison

    I got this issue on ubuntu, and the following steps worked for me.

    1. Build manually with cmake (It seems that make does not work anymore.), following the llama.cpp build instruction.
    2. The above creates executable files (llama-*) under llama.cpp/build/bin. Copy them over to directly under llama.cpp/.
    3. Re-run the failed unsloth call. (In my case, push_to_hub_gguf.)

    It works for me.

    In Collab env i used

    !(cd llama.cpp; cmake -B build;cmake --build build --config Release)
    

    Then i copied the executable to /content/llama.cpp directory with cp then i re-ran the celd.

  17. fumiama commented on Jan 27, 2025

    @fumiama

    I got this issue on ubuntu, and the following steps worked for me.

    1. Build manually with cmake (It seems that make does not work anymore.), following the llama.cpp build instruction.
    2. The above creates executable files (llama-*) under llama.cpp/build/bin. Copy them over to directly under llama.cpp/.
    3. Re-run the failed unsloth call. (In my case, push_to_hub_gguf.)

    It works for me.

    In Collab env i used

    !(cd llama.cpp; cmake -B build;cmake --build build --config Release)
    

    Then i copied the executable to /content/llama.cpp directory with cp then i re-ran the celd.

    Thanks. Same problem, following this instruction and solved. Seems that the llama.cpp compiling logic of unsloth should be renewed.

  18. fumiama commented on Jan 27, 2025

    @fumiama

    Just noticed that it has been soled in #1375. Maybe the reason that I met this problem is because I manually paused the quantizing process just after it start.

  19. Deluxer commented on Jan 29, 2025

    @Deluxer

    Summary: Just copy llama.cpp/build/bin/llama-quantize to llama.cpp/ , then try again.

    I got this issue on ubuntu, and the following steps worked for me.

    1. Build manually with cmake (It seems that make does not work anymore.), following the llama.cpp build instruction.
    2. The above creates executable files (llama-*) under llama.cpp/build/bin. Copy them over to directly under llama.cpp/.
    3. Re-run the failed unsloth call. (In my case, push_to_hub_gguf.)
  20. everythingisc00l commented on Feb 9, 2025

    @everythingisc00l
    Contributor

    UPD 10.02.2025:

    This is my recept for fix this bug ONLY FOR WINDOWS 11. (I'm using Windows 11 with WSL Ubuntu)

    if you wanna full solution check my fix: #1649

    1. clone official repo of llama.cpp.
    2. build with cmake and be sure, that after this you have llama-quantize.exe in your folder https://github.com/ggerganov/llama.cpp/blob/master/docs/build.md#cpu-build
    3. for successful saving .gguf model, you need to edit file site-packages/unsloth/save.py where you have codelines like this:

    llama-quantize to llama-quantize.exe

    quantize_location = None if os.path.exists("llama.cpp/quantize.exe"): quantize_location = "llama.cpp/quantize.exe" elif os.path.exists("llama.cpp/llama-quantize.exe"): quantize_location = "llama.cpp/llama-quantize.exe"

    and this working for me.

    Image

  21. mw-ctrl commented on Mar 12, 2025

    @mw-ctrl

    Hello,
    on my ubuntu server I have a new error due to export the model with llama.cpp. I copied llama-quantize to the main folder llama.cpp but now I get a new error when I try to export the model with: model.save_pretrained_gguf("mymodel", tokenizer, quantization_method = "q4_k_m", maximum_memory_usage=0.7)

    line 824, in try_execute
    raise RuntimeError(f"*** Unsloth: Failed compiling llama.cpp with {line}. Please report this ASAP!")
    RuntimeError: *** Unsloth: Failed compiling llama.cpp with WARNING:hf-to-gguf:**************************************************************************************
    . Please report this ASAP!

    now im very confused because it works one and now I have really no idea how to fix this. But this is just for the phi4 model

  22. hoffor commented on Mar 25, 2025

    @hoffor

    SUPER DUMB EASY WORKAROUND FOR WINDOWS USERS:

    just move the binaries from the latest llama build .zip into the base llama.cpp folder. don't need to build anything yourself

    get em from here: https://github.com/ggml-org/llama.cpp/releases

    i used llama-b4951-bin-win-cuda-cu12.4-x64.zip (since i'm using cuda toolkit 12.4) and it works just fine


    also in "Lib\site-packages\unsloth\save.py" i had to change:

    command = f"./{quantize_location} {full_precision_location} "\
                    f"{final_location} {quant_method} {n_cpus}"
    

    to: command = f"{Path(quantize_location).absolute()} {full_precision_location} {final_location} {quant_method} {n_cpus}"

    or else it'll tell me '.' is not recognized as an internal or external command, operable program or batch file.

    edit: btw i made a full on script to just set everything up for unsloth from scratch if you're ever feeling stuck (comes with an example notebook and dataset too): https://github.com/hoffor/llms-are-dumb

  23. rnckp commented on Apr 12, 2025

    @rnckp

    Hello, on my ubuntu server I have a new error due to export the model with llama.cpp. I copied llama-quantize to the main folder llama.cpp but now I get a new error when I try to export the model with: model.save_pretrained_gguf("mymodel", tokenizer, quantization_method = "q4_k_m", maximum_memory_usage=0.7)

    line 824, in try_execute raise RuntimeError(f"*** Unsloth: Failed compiling llama.cpp with {line}. Please report this ASAP!") RuntimeError: *** Unsloth: Failed compiling llama.cpp with WARNING:hf-to-gguf:************************************************************************************** . Please report this ASAP!

    now im very confused because it works one and now I have really no idea how to fix this. But this is just for the phi4 model

    Same here. I observe the same error when trying to convert a finetuned Phi-4 to GGUF. How to fix this?

  24. mw-ctrl commented on Apr 12, 2025

    @mw-ctrl

    @rnckp To resolve a similar issue in the past, I incorporated the export directly into the fine-tuning process using this code:"

    trainer_stats = unsloth_train(trainer)
    trainer.save_model()
    model.save_pretrained("gguf", tokenizer, quantization_method="q4_k_m")

  25. Fredrik-C commented on May 5, 2025

    @Fredrik-C

    SUPER DUMB EASY WORKAROUND FOR WINDOWS USERS:

    just move the binaries from the latest llama build .zip into the base llama.cpp folder. don't need to build anything yourself

    get em from here: https://github.com/ggml-org/llama.cpp/releases

    i used llama-b4951-bin-win-cuda-cu12.4-x64.zip (since i'm using cuda toolkit 12.4) and it works just fine

    also in "Lib\site-packages\unsloth\save.py" i had to change:

    command = f"./{quantize_location} {full_precision_location} "\
                    f"{final_location} {quant_method} {n_cpus}"
    

    to: command = f"{Path(quantize_location).absolute()} {full_precision_location} {final_location} {quant_method} {n_cpus}"

    or else it'll tell me '.' is not recognized as an internal or external command, operable program or batch file.

    edit: btw i made a full on script to just set everything up for unsloth from scratch if you're ever feeling stuck (comes with an example notebook and dataset too): https://github.com/hoffor/llms-are-dumb

    My savior!!!

    After fiddeling for hours with make, cmake, g++ etc I came to the conclusion to use the precompiled packages and got stuck on the "." error.

    GAH... I was getting passed the '.' error by the save.py mod, just to get another error:

    
    Unsloth: Conversion completed! Output location: C:\github\LocalLLM\qwen3_14b_roocode_gguf\qwen3-14b-roocode-q5_k_m.gguf\unsloth.BF16.gguf
    Unsloth: [2] Converting GGUF 16bit into q5_k_m. This might take 20 minutes...
    main: build = 5284 (9b61acf0)
    main: built with MSVC 19.29.30159.0 for Windows AMD64
    main: quantizing 'C:\github\LocalLLM\qwen3_14b_roocode_gguf\qwen3-14b-roocode-q5_k_m.gguf\unsloth.BF16.gguf' to 'C:\github\LocalLLM\qwen3_14b_roocode_gguf\qwen3-14b-roocode-q5_k_m.gguf\unsloth.Q5_K_M.gguf' as Q5_K_M using 64 threads     
    llama_model_loader: loaded meta data with 27 key-value pairs and 443 tensors from C:\github\LocalLLM\qwen3_14b_roocode_gguf\qwen3-14b-roocode-q5_k_m.gguf\unsloth.BF16.gguf (version GGUF V3 (latest))
    llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
    llama_model_loader: - kv   0:                       general.architecture str              = qwen3
    llama_model_loader: - kv   1:                               general.type str              = model
    llama_model_loader: - kv   2:                               general.name str              = Qwen3 14b Roocode Q5_K_M.Gguf
    llama_model_loader: - kv   3:                           general.finetune str              = roocode-q5_k_m.gguf
    llama_model_loader: - kv   4:                           general.basename str              = qwen3
    llama_model_loader: - kv   5:                         general.size_label str              = 14B
    llama_model_loader: - kv   6:                          qwen3.block_count u32              = 40
    llama_model_loader: - kv   7:                       qwen3.context_length u32              = 40960
    llama_model_loader: - kv   8:                     qwen3.embedding_length u32              = 5120
    llama_model_loader: - kv   9:                  qwen3.feed_forward_length u32              = 17408
    llama_model_loader: - kv  10:                 qwen3.attention.head_count u32              = 40
    llama_model_loader: - kv  11:              qwen3.attention.head_count_kv u32              = 8
    llama_model_loader: - kv  12:                       qwen3.rope.freq_base f32              = 1000000.000000
    llama_model_loader: - kv  13:     qwen3.attention.layer_norm_rms_epsilon f32              = 0.000001
    llama_model_loader: - kv  14:                 qwen3.attention.key_length u32              = 128
    llama_model_loader: - kv  15:               qwen3.attention.value_length u32              = 128
    llama_model_loader: - kv  16:                          general.file_type u32              = 32
    llama_model_loader: - kv  17:               general.quantization_version u32              = 2
    llama_model_loader: - kv  18:                       tokenizer.ggml.model str              = gpt2
    llama_model_loader: - kv  19:                         tokenizer.ggml.pre str              = qwen2
    llama_model_loader: - kv  20:                      tokenizer.ggml.tokens arr[str,151936]  = ["!", "\"", "#", "$", "%", "&", "'", ...
    llama_model_loader: - kv  21:                  tokenizer.ggml.token_type arr[i32,151936]  = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
    llama_model_loader: - kv  22:                      tokenizer.ggml.merges arr[str,151387]  = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",...
    llama_model_loader: - kv  23:                tokenizer.ggml.eos_token_id u32              = 151645
    llama_model_loader: - kv  24:            tokenizer.ggml.padding_token_id u32              = 151654
    llama_model_loader: - kv  25:               tokenizer.ggml.add_bos_token bool             = false
    llama_model_loader: - kv  26:                    tokenizer.chat_template str              = {%- if tools %}\n    {{- '<|im_start|>...
    llama_model_loader: - type  f32:  161 tensors
    llama_model_loader: - type bf16:  282 tensors
    Error saving model in GGUF format: Unsloth: Quantization failed!
    
  26. akimasax commented on May 29, 2025

    @akimasax

    Hello, on my ubuntu server I have a new error due to export the model with llama.cpp. I copied llama-quantize to the main folder llama.cpp but now I get a new error when I try to export the model with: model.save_pretrained_gguf("mymodel", tokenizer, quantization_method = "q4_k_m", maximum_memory_usage=0.7)
    line 824, in try_execute raise RuntimeError(f"*** Unsloth: Failed compiling llama.cpp with {line}. Please report this ASAP!") RuntimeError: *** Unsloth: Failed compiling llama.cpp with WARNING:hf-to-gguf:************************************************************************************** . Please report this ASAP!
    now im very confused because it works one and now I have really no idea how to fix this. But this is just for the phi4 model

    I’m also unable to convert Phi-4 into GGUF in the same way. I was able to do it before.
    Has anyone managed to solve this?

  27. akimasax commented on Jun 4, 2025

    @akimasax

    @mw-ctrl @rnckp
    I've solved Phi-4 GGUF convering problem in my env.

    Cause

    During 4-bit training, the saved base_model_name becomes:

    unsloth/phi-4-unsloth-bnb-4bit
    

    Attempting to load the tokenizer from that name triggers the hf-to-gguf warning.
    I also encountered the same error in the official Unsloth Phi-4 Colab notebook.

    Solution

    1. Load the model from your local checkpoint only:
    model, _ = FastLanguageModel.from_pretrained(model_name=checkpoint_path)
    1. Explicitly load the tokenizer from the original unsloth/Phi-4:
    _, tokenizer = FastLanguageModel.from_pretrained(model_name="unsloth/Phi-4")
    1. And then, convert the model to GGUF:
    model.save_pretrained_gguf("model", tokenizer, quantization_method=method)

    This separation works for me.
    The other llama.cpp–related errors were resolved using the steps at the following link, and I was able to convert the Phi-4 model to GGUF:https://github.com/osllmai/llama.cpp/blob/main/docs/build.md

  28. zwb1988 commented on Sep 20, 2025

    @zwb1988

    I also encountered this problem. After digging into the save.py, I see it checks for the llama-quantize executable in the environment path. If it is not there and convert_hf_to_gguf.py (included in the llama.cpp repo), then it clones the llama.cpp to the local project folder and tries to build it with CMake.

    I let it clone, because I want the convert_hf_to_gguf.py from the repo, but I don't want to compile llama.cpp with CMake. So, I installed the pre-compiled binary (which includes the quantize executable) using Winget

    1. One problem with the save.py is that when it references the cloned llama.cpp repo, it will build with CMake & override the quantize_location variable to None, which has already found in the PATH (from the get_executable method). So you have to make a minor changes to instruct it to use the quantize_location that has already found in the environment PATH.
            # quantize_location = None # comment this line out
            if quantize_location is None: # add this line to skip detecting the quantize executable if it is already found by get_executable
                # quantize_location may already obtained using system path (get_executable), continue if it is not obtained
                if os.path.exists("llama.cpp/quantize.exe"):
                    quantize_location = "llama.cpp/quantize.exe"
                elif os.path.exists("llama.cpp/quantize"):
                    quantize_location = "llama.cpp/quantize"
                elif os.path.exists("llama.cpp/llama-quantize.exe"):
                    quantize_location = "llama.cpp/llama-quantize.exe"
                elif os.path.exists("llama.cpp/llama-quantize"):
                    quantize_location = "llama.cpp/llama-quantize"
                elif os.path.exists("llama.cpp/build/bin/llama-quantize"):
                    quantize_location = "llama.cpp/build/bin/llama-quantize"
                elif os.path.exists("llama.cpp/build/bin/quantize"):
                    quantize_location = "llama.cpp/build/bin/quantize"
                else:
                    raise RuntimeError(
                        "Unsloth: The file 'llama.cpp/llama-quantize' or `llama.cpp/quantize` does not exist.\n"\
                        "We've also double checked the building directory under 'llama.cpp/build/bin/'.\n"\
                        "But we expect this file to exist! Check if the file exists under llama.cpp and investigate the building process of llama.cpp (make/cmake)!"
                    )
                pass

    In this case, you will have both llama-quantize.exe & convert_hf_to_gguf.py to continue saving the model.

    1. After that you will encounter another problem, it save.py will give you this error:
    Unsloth: [2] Converting GGUF 16bit into q4_k_m. This might take 20 minutes...
    '.' is not recognized as an internal or external command,
    

    Follow the answer provided by @hoffor , it resolves the problem and saves the result model.

                print(f"Unsloth: [2] Converting GGUF 16bit into {quant_method}. This might take 20 minutes...")
                final_location = str((Path(model_directory) / f"unsloth.{quant_method.upper()}.gguf").absolute())
                
                command = None
                if sys.platform == "win32": #check for windows environment
                    command = f"{Path(quantize_location).absolute()} {full_precision_location} "\
                        f"{final_location} {quant_method} {n_cpus}"
                else:
                    command = f"./{quantize_location} {full_precision_location} "\
                                    f"{final_location} {quant_method} {n_cpus}"
    
                try_execute([command,], force_complete = True)
  29. rolandtannous commented on Oct 15, 2025

    @rolandtannous
    Contributor

    @AleefBilal @Antonytm @ChernXiangyu @ColtDS @Deluxer @FotieMConstant @Fredrik-C @Govindraj07 @Han-SeungJun @Haowen-Ji @Justin22122002 @LeMoussel @MisterSoandSo @OscarArroyoVega @Seynro @XiaomoWu @Zhangy-ly @aghac19 @akimasax @alarv @amygbAI @andthattoo @beiwilliam @brlin-tw @brycelund @chrispangg @codelion @demensdeum @devinwang @divmgl @ericbanzuzi @everythingisc00l @fumiama @gaoshan0007 @goerkemballmueller @hamishdickson @hideaki @hoffor @huan161299 @hwpoison @ikramMc @jainpradeep @jeehunseo @jhlu2019 @josemgmz @jrsynow @karman103 @kenkeiras @kholiavko-roman @kikiyu @kkk112 @lastrei @lideyang @manu-one @maziyarpanahi @mik8142 @mjbatalha @mrtpk @mw-ctrl @nokey93 @okoliechykwuka @optix2000 @ozziek @phoenix1028 @pranavs1997 @prcvoldermort @rektyyy @rnckp @rorubyy @rosameliacarioni @sahajre @scherbakovdmitri @serena97 @singlerock @skippetr @smirki @stevechk @theodufort @thinhlpg @throttlekitty @thyarles @topikuq @trash-fish @tuananhit1612 @variable @whisper-bye @yangyifei-gogogo @yuxiaojian @zhuqifan @zwb1988 @zyx20030325

    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)

    Let me know how this goes for you.

    Thanks!

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 - pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions