Skip to content

Conversation

@AmarUCLA
Copy link

Modifying convert_hf_to_gguf.py

Make sure to read the contributing guidelines before submitting a PR

Fixing this issue when converting Gemma 3 12B+27B models from safetensor to gguf when the tensor is named 'model.multi_modal_projector.' instead of 'multi_modal_projector.'

INFO:hf-to-gguf:blk.3.attn_v.weight, torch.bfloat16 --> F16, shape = {3840, 2048}
INFO:hf-to-gguf:blk.4.ffn_gate.weight, torch.bfloat16 --> F16, shape = {3840, 15360}
INFO:hf-to-gguf:blk.4.ffn_up.weight, torch.bfloat16 --> F16, shape = {3840, 15360}
INFO:hf-to-gguf:blk.4.attn_k_norm.weight, torch.bfloat16 --> F32, shape = {256}
INFO:hf-to-gguf:blk.4.attn_k.weight, torch.bfloat16 --> F16, shape = {3840, 2048}
INFO:hf-to-gguf:blk.4.attn_output.weight, torch.bfloat16 --> F16, shape = {4096, 3840}
INFO:hf-to-gguf:blk.4.attn_q_norm.weight, torch.bfloat16 --> F32, shape = {256}
INFO:hf-to-gguf:blk.4.attn_q.weight, torch.bfloat16 --> F16, shape = {3840, 4096}
INFO:hf-to-gguf:blk.4.attn_v.weight, torch.bfloat16 --> F16, shape = {3840, 2048}
Traceback (most recent call last):
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 8817, in
main()
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 8811, in main
model_instance.write()
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 431, in write
self.prepare_tensors()
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 298, in prepare_tensors
for new_name, data_torch in (self.modify_tensors(data_torch, name, bid)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 5054, in modify_tensors
return [(self.map_tensor_name(name), data_torch)]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/llama.cpp/convert_hf_to_gguf.py", line 257, in map_tensor_name
raise ValueError(f"Can not map tensor {name!r}")
ValueError: Can not map tensor 'model.multi_modal_projector.mm_input_projection_weight'

@github-actions github-actions bot added the python python script changes label Aug 22, 2025
@CISC
Copy link
Collaborator

CISC commented Aug 23, 2025

Please update Gemma3VisionModel too and test --mmproj conversion.

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

Labels

python python script changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants