Unverified Commit ff80718e authored by Daniel Hiltgen's avatar Daniel Hiltgen Committed by GitHub
Browse files

fix crash in old clients with quantization progress (#10710)

Older clients assumed the digest was at least 19 characters long so increase the size
of the dummy digest to avoid array out of bounds crashes.
parent 0aa8b371
...@@ -430,7 +430,7 @@ func quantizeLayer(layer *layerGGML, quantizeType string, fn func(resp api.Progr ...@@ -430,7 +430,7 @@ func quantizeLayer(layer *layerGGML, quantizeType string, fn func(resp api.Progr
fnWrap := func(n uint64) { fnWrap := func(n uint64) {
done := doneBytes.Add(n) done := doneBytes.Add(n)
progress := float32(done) / float32(totalBytes) progress := float32(done) / float32(totalBytes)
fn(api.ProgressResponse{Status: fmt.Sprintf("quantizing %s model to %s", ft, quantizeType), Digest: "0", Total: layer.Size, Completed: int64(progress * float32(layer.Size))}) fn(api.ProgressResponse{Status: fmt.Sprintf("quantizing %s model to %s", ft, quantizeType), Digest: "0000000000000000000", Total: layer.Size, Completed: int64(progress * float32(layer.Size))})
} }
ftype, err := ggml.ParseFileType(quantizeType) ftype, err := ggml.ParseFileType(quantizeType)
if err != nil { if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment