-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Eval bug: convert_hf_to_gguf.py: ValueError when converting Gemma3n models due to double tensor mapping #19079
Description
convert_hf_to_gguf.py: ValueError when converting Gemma3n models due to double tensor mapping
Description
I encountered a ValueError: Can not map tensor when trying to convert a Gemma 3n (Vision/Audio) model using convert_hf_to_gguf.py.
python .\convert_hf_to_gguf.py ..\gemma-3n-E4B-it\ --mmprojAnd I print the name and new name varriable in ModelBase
def map_tensor_name(self, name: str, try_suffixes: Sequence[str] = (".weight", ".bias")) -> str:
new_name = self.tensor_map.get_name(key=name, try_suffixes=try_suffixes)
print(f"name: {name}, new_name: {new_name}") # Here
if new_name is None:
raise ValueError(f"Can not map tensor {name!r}")
return new_name
Operating systems
Windows
GGML backends
CUDA
Hardware
12700KF + 5090
Models
Gemma3n
Problem description & steps to reproduce
Analysis In Gemma3nVisionAudioModel.modify_tensors:
-
The script correctly maps the HF name to the GGUF name (e.g., v.blk.0.0.bn1.weight).
-
However, it then calls yield from super().modify_tensors(data_torch, new_name, bid).
-
The parent class (Model.modify_tensors) receives new_name (the GGUF name) as the input name.
-
It calls self.map_tensor_name(name) on this already-converted name.
-
Since v.blk.0.0.bn1.weight is not in the tensor_map keys (it is a value/result), the mapping fails with ValueError.
Proposed Fix We should yield the result directly instead of passing the already-mapped name back to the parent class for re-mapping.
modify_tensors function in Gemma3nVisionAudioModel class
# yield from super().modify_tensors(data_torch, new_name, bid)
yield (new_name, data_torch)First Bad Commit
No response