Description
Git commit
git reset --hard origin/master
Operating systems
Mac
GGML backends
CUDA
Problem description & steps to reproduce
I am attempting to convert a Qwen3-8B model that was fine-tuned with LoRA using MLX and then fused, to GGUF format using llama.cpp's convert_hf_to_gguf.py script.
python -m mlx_lm.convert --hf-path Qwen/Qwen3-8B --mlx-path ./qwen3_8b_mlx_quantized -q
uv run mlx_lm.lora --train --model ./qwen3_8b_mlx_quantized --data ./data --batch-size 2 --iter 2000 (mention that adapters.safetensors was produced in ./adapters directory)
uv run python -m mlx_lm.fuse --model ./qwen3_8b_mlx_quantized --adapter-path ./adapters --save-path ./merged_qwen3_8b_mlx_fused --hf-path Qwen/Qwen3-8B
uv run python ../llama.cpp/convert_hf_to_gguf.py ./merged_qwen3_8b_mlx_fused --outfile qwen3_euaiact_8b_fused.gguf --outtype f16
The convert_hf_to_gguf.py script fails with a ValueError: Can not map tensor 'lm_head.biases'."
"I have verified that the lm_head.biases and lm_head.scales tensors exist in the model's model.safetensors.index.json (even in the fused model), which matches the original Qwen3 Hugging Face model structure."
Paste the output of cat merged_qwen3_8b_mlx_fused/model.safetensors.index.json | grep "lm_head":
JSON
"lm_head.biases": "model.safetensors",
"lm_head.scales": "model.safetensors",
"lm_head.weight": "model.safetensors",
uv run python ../llama.cpp/convert_hf_to_gguf.py ./merged_qwen3_8b_mlx_fused --outfile
First Bad Commit
No response
Compile command
cmake worked.
Relevant log output
qwen3_euaiact_8b_fused.gguf --outtype f16
INFO:hf-to-gguf:Loading model: merged_qwen3_8b_mlx_fused
INFO:hf-to-gguf:Model architecture: Qwen3ForCausalLM
INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only
INFO:hf-to-gguf:Exporting model...
INFO:hf-to-gguf:gguf: loading model weight map from 'model.safetensors.index.json'
INFO:hf-to-gguf:gguf: loading model part 'model.safetensors'
Traceback (most recent call last):
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 6718, in <module>
main()
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 6712, in main
model_instance.write()
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 409, in write
self.prepare_tensors()
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 277, in prepare_tensors
for new_name, data_torch in (self.modify_tensors(data_torch, name, bid)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 2743, in modify_tensors
yield from super().modify_tensors(data_torch, name, bid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 245, in modify_tensors
return [(self.map_tensor_name(name), data_torch)]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommy.jakobsen/Documents/_DEMOS/_Ai_agents/finetune/euaiact/../llama.cpp/convert_hf_to_gguf.py", line 236, in map_tensor_name
raise ValueError(f"Can not map tensor {name!r}")
ValueError: Can not map tensor 'lm_head.biases