Skip to content

[Bug] Failed to load gpt-oss-20b GGUF model - Invalid tensor type across multiple quantizations #3124

Closed

Description

@Oleg777778

Description:
When attempting to load the gpt-oss-20b model (multiple quantization versions), llama.cpp fails with an error about an invalid tensor type. The issue persists across different quantizations of the same model.

Error message:

gguf_init_from_file_impl: tensor 'blk.0.ffn_down_exps.weight' has invalid ggml type 39 (NONE)
gguf_init_from_file_impl: failed to read tensor info
llama_model_load: error loading model: llama_model_loader: failed to load model from I:\SKLAD\!Models_GGUF\Unsloth\gpt-oss-20b-Q4_K_M.gguf

Reproduction steps:

  1. Download any quantization version of gpt-oss-20b GGUF model
  2. Run the following command:
llama-cli.exe -m I:\SKLAD\!Models_GGUF\Unsloth\gpt-oss-20b-Q4_K_M.gguf --threads 6 --prio 2 --ctx-size 32768 --flash-attn --batch-size 24 --n-predict -2 --min-p 0.0 --mlock --no-mmap --temp 0.3 --n-gpu-layers 99 --top-k 20 --top-p 0.8 --repeat-penalty 1.0 --multiline-input --no-display-prompt

Expected behavior:
The model should load successfully and be ready for inference.

Actual behavior:
The loader fails with the same error about invalid tensor type across all quantization versions tried.

System information:

  • Windows 10 [Version 10.0.19045.5487]
  • NVIDIA GeForce RTX 4060 Ti (16GB VRAM)
  • llama.cpp build 6082 (5aa1105d) with MSVC 19.43.34810.0 for x64

Additional information:

  1. The error persists across multiple quantization versions of the same model (tried Q4_K_M and others)
  2. The common factor is the tensor 'blk.0.ffn_down_exps.weight' having an invalid type (NONE)
  3. This suggests either:
    • A fundamental issue with the GGUF conversion of this particular model
    • An incompatibility between the model's architecture and current llama.cpp implementation
    • Corrupted source files used for conversion

Troubleshooting steps attempted:

  • Verified CUDA is working (device detected successfully)
  • Confirmed sufficient VRAM is available (15GB free)
  • Tried multiple quantization versions of the same model
  • Verified file integrity (no download errors)

Microsoft Windows [Version 10.0.19045.5487]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>C:\llama.cpp\build\bin\Release\llama-cli.exe -m I:\SKLAD!Models_GGUF\Unsloth\gpt-oss-20b-Q4_K_M.gguf --threads 6 --prio 2 --ctx-size 32768 --flash-attn --batch-size 24 --n-predict -2 --min-p 0.0 --mlock --no-mmap --temp 0.3 --n-gpu-layers 99 --top-k 20 --top-p 0.8 --repeat-penalty 1.0 --multiline-input --no-display-prompt
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 4060 Ti, compute capability 8.9, VMM: yes
build: 6082 (5aa1105d) with MSVC 19.43.34810.0 for x64
main: llama backend init
main: load the model and apply lora adapter, if any
llama_model_load_from_file_impl: using device CUDA0 (NVIDIA GeForce RTX 4060 Ti) - 15225 MiB free
gguf_init_from_file_impl: tensor 'blk.0.ffn_down_exps.weight' has invalid ggml type 39 (NONE)
gguf_init_from_file_impl: failed to read tensor info
llama_model_load: error loading model: llama_model_loader: failed to load model from I:\SKLAD!Models_GGUF\Unsloth\gpt-oss-20b-Q4_K_M.gguf
llama_model_load_from_file_impl: failed to load model
common_init_from_params: failed to load model 'I:\SKLAD!Models_GGUF\Unsloth\gpt-oss-20b-Q4_K_M.gguf'
main: error: unable to load model

C:\Windows\System32>

Activity

  1. Oleg777778 commented on Aug 9, 2025

    @Oleg777778
    Author

    Additional Context from Linux Test

    Reproduced on Ubuntu 24.04 with identical failure:

    • Command:
      llama-cli -m /home/oleg/gpt-oss-20b-Q4_K_M.gguf -ngl 99 --flash-attn --mlock --no-mmap
    • Error:
      gguf_init_from_file_impl: tensor 'blk.0.ffn_down_exps.weight' has invalid ggml type 39 (NONE)
      
    • Environment:
      • llama.cpp build 5935 (2adf8d83)
      • CUDA enabled (RTX 4060 Ti, 15.7GB VRAM free)
      • Same behavior across Windows/Linux

    Critical Findings

    1. MoE-Specific Failure:
      The 3D tensor blk.0.ffn_down_exps.weight ([2880, 2880, 32]) is not serialized correctly in GGUF, suggesting:

      • The converter mishandled MoE weights.
      • GGUF type 39 (NONE) is invalid for this architecture.
    2. No Workarounds Found:

      • Fails with identical error on different systems.
      • Other quantizations (e.g., Q4_K_M, Q5_0) exhibit the same issue.

    Suggested Actions

    1. Tag Unsloth Team: Request confirmation if:
      • This is a known conversion bug.
      • Alternative GGUF files exist for MoE models.
    2. Check Model Source: Verify if the original non-GGUF model works with vLLM (given the [vllm] tag in metadata).

    Priority: High

    This blocks all usage of GGUF-quantized GPT-OSS-20B until resolved.

    oleg@oleg-MS-7B86:~$ llama-cli \ -m /home/oleg/gpt-oss-20b-Q4_K_M.gguf \ -ngl 99 -c 16384 --temp 0.3 --multiline-input --mlock --no-mmap --batch-size 24 --threads 6 --flash-attn --prio 2 ggml_cuda_init: GGML_CUDA_FORCE_MMQ: yes ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no ggml_cuda_init: found 1 CUDA devices: Device 0: NVIDIA GeForce RTX 4060 Ti, compute capability 8.9, VMM: yes build: 5935 (2adf8d83) with cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 for x86_64-linux-gnu main: llama backend init main: load the model and apply lora adapter, if any llama_model_load_from_file_impl: using device CUDA0 (NVIDIA GeForce RTX 4060 Ti) - 15704 MiB free gguf_init_from_file_impl: tensor 'blk.0.ffn_down_exps.weight' has invalid ggml type 39 (NONE) gguf_init_from_file_impl: failed to read tensor info llama_model_load: error loading model: llama_model_loader: failed to load model from /home/oleg/gpt-oss-20b-Q4_K_M.gguf llama_model_load_from_file_impl: failed to load model common_init_from_params: failed to load model '/home/oleg/gpt-oss-20b-Q4_K_M.gguf' main: error: unable to load model oleg@oleg-MS-7B86:~$

  2. moonray commented on Aug 11, 2025

    @moonray

    I have the same problem for the 20b q5_k_m variant.
    Running on windows 10, latest version of ollama 0.11.4, 3080ti.

  3. manfreddev commented on Aug 15, 2025

    @manfreddev

    Same here, gpt-oss-20b-GGUF:UD-Q6_K_XL on Radeon 9070 (16gb, ollama 20250812 on Ubuntu + rocm)

  4. danielhanchen commented on Aug 15, 2025

    @danielhanchen
    Member

    Hey guys - you will have to build llama.cpp from source as seen in https://docs.unsloth.ai/basics/gpt-oss-how-to-run-and-fine-tune#run-gpt-oss-120b ie:

    apt-get update
    apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
    git clone https://github.com/ggml-org/llama.cpp
    cmake llama.cpp -B llama.cpp/build \
        -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON
    cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-gguf-split
    cp llama.cpp/build/bin/llama-* llama.cpp

    For Ollama, unfortunately they do not support GGUFs at the moment - they are working on it!

  5. manfreddev commented on Aug 16, 2025

    @manfreddev

    It seems that release b6096 adds support for ggml type 39 if i am correct. Diff: ggml-org/llama.cpp@b6095...b6096
    This ollama pull request relates to the llama.cpp handling of MXFP4 (comment from mxyng): ollama/ollama#11823
    Changes seem to be present from 0.11.5 (https://github.com/ollama/ollama/blob/v0.11.5-rc2/ml/backend/ggml/ggml/include/ggml.h)

  6. Oleg777778 commented on Aug 17, 2025

    @Oleg777778
    Author

    Well, then why do we need such a capricious model? Moreover, I have already managed to try this same model, assembled by different authors. And everywhere there is exactly the same error.

  7. formorter commented on Aug 26, 2025

    @formorter

    Got the same error with gguf gpt-oss-20b on vllm
    gguf_init_from_file_impl: tensor 'blk.0.ffn_down_exps.weight' has invalid ggml type 39 (NONE)

  8. rolandtannous commented on Oct 15, 2025

    @rolandtannous
    Contributor

    @Nitco-Loris @Oleg777778 @formorter @manfreddev @moonray @treitmayr @ywatanabex

    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)

    8 - Finally, If you are on a local machine, are facing frequent dependency problems while installing/updating unsloth and can run containers, I highly recommend that you use our official docker containerized environment. No more dependency conflicts. It's safe (non root user) and comes with a prebuilt pretested environment and the most up to date notebooks for you to run. You can find the Docker container image here: https://hub.docker.com/r/unsloth/unsloth
    The how to guide for the docker container can be found here: https://docs.unsloth.ai/get-started/install-and-update/docker

    Thanks!

  9. danielhanchen commented on Sep 6, 2026

    @danielhanchen
    Member

    Not an Unsloth bug sorry! gpt-oss GGUFs are MXFP4 and llama.cpp only reads those from b6096, Ollama from 0.11.5. Update either one and they'll load. We don't pin an old llama.cpp so a fresh install gets the latest.

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

    bugfixed - pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions