GGUF metadata KV overrides, re #1011#1116
Conversation
|
@phiharri looks good, is the sentinel value not required, I saw that in your original PR. |
|
Not sure where I got that idea from tbh, pretty sure it isn't needed. Thought about checking len(key)<128 for potential overflow but it seems ctypes takes care of that already 🤷 |
|
I think it is necessary to add an additional key and set it to the null byte, see https://github.com/ggerganov/llama.cpp/blob/6f9939d119b2d004c264952eb510bd106455531e/llama.cpp#L2250 |
|
Sure, how's this look? Elements get initialised empty/null but if you wanted to be explicit we can add |
|
@phiharri that's correct however I think(?) we still need to store the reference to that byte string because we're passing it into a c data structure and want to avoid any memory issues. |
|
Aren't we just modifying data in the existing Definitely seems the array gets null initialised so I don't think Peeking the memory of the last element without doing any |
|
Doh you're right, I thought the key was a |
|
Awesome, okay good to merge it then. Thanks for the contribution @phiharri |

(starting from a clean branch)
76aafa6 didn't work for me,
_kv_overrides_array[i]refs uninitialisediand I think it's necessary to instantiate the CStructs array with()or it ends up a generic PyCArrayType.Let me know what you think about this PR instead.
Simple validation that it takes effect: