Commit 9df67cd
authored
[GGUF] metadata serialization into Uint8Arrray (#1740)
### Description
This PR introduces function that serializes GGUF metadata/header into
Uint8Arrray so that I can use
#1718 to update gguf
metadata on hf.co
* `serializeTypedMetadata()` - Serialize GGUF metadata to binary format
* `serializeGgufHeader()` - Create complete GGUF headers with metadata +
tensor info + alignment
* Enhanced `gguf()` function - Now returns `littleEndian` property for
endianness detection
### Usage example
```ts
// Edit first kB of file
await commit({
repo,
accessToken: "hf_...",
operations: [{
type: "edit",
originalContent: new Blob(original gguf header),
edits: [{
start: 0,
end: 1000,
content: new Blob(serializeGgufHeader(new gguf header with updated metadata))
}]
}]
})
```1 parent 2e1ed11 commit 9df67cd
3 files changed
+706
-13
lines changed
0 commit comments