fix: write gguf padding (#10510)

* add gguf_test

* fix padding

padding was being added to offset but not to the running count
This commit is contained in:
Michael Yang
2025-04-30 17:59:31 -07:00
committed by GitHub
parent ad3c7c9bda
commit a7835c6716
2 changed files with 65 additions and 1 deletions

View File

@@ -531,11 +531,12 @@ func WriteGGUF(ws io.WriteSeeker, kv KV, ts []Tensor) error {
var s uint64
for _, t := range ts {
t.Offset = s + uint64(ggufPadding(int64(s), int64(alignment)))
t.Offset = s
if err := ggufWriteTensorInfo(ws, t); err != nil {
return err
}
s += t.Size()
s += uint64(ggufPadding(int64(s), int64(alignment)))
}
for _, t := range ts {