gguf : fix division by zero#20716
Conversation
|
While I am for this change, to explicitly not support zero sized tensors, safetensors does support this. And over at sd.cpp there are some models that currently use this. |
|
Also more generally: right now the ggml API does allow the user to create zero-sized tensors. I think preferably we would either allow or disallow these consistently for ggml and GGUF. |
|
I think disallowing 0-element tensors everywhere is more preferable (which can be follow-up PRs), as we don't have any use cases for that. I suspect that safetensors support it because they also have scalar tensors. I have no ideas how they are stored at byte level, but it make more sense (and it is indeed a common practice) to convert pytorch scalar tensor into GGML 1-element tensor |
Prevent malformed data causing divisions by zero and crashes.