mirror of
https://github.com/ollama/ollama.git
synced 2026-04-22 00:36:11 +02:00
types
This commit is contained in:
@@ -29,6 +29,8 @@ func NewLayer(r io.Reader, mediatype string) (*Layer, error) {
|
||||
defer os.Remove(temp.Name())
|
||||
|
||||
sha256sum := sha256.New()
|
||||
if
|
||||
|
||||
n, err := io.Copy(io.MultiWriter(temp, sha256sum), r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -3,7 +3,6 @@ package server
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"cmp"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -12,7 +11,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sort"
|
||||
|
||||
"github.com/ollama/ollama/api"
|
||||
"github.com/ollama/ollama/convert"
|
||||
@@ -244,19 +243,10 @@ func parseFromFile(ctx context.Context, file *os.File, digest string, fn func(ap
|
||||
}
|
||||
|
||||
var reader io.Reader = io.NewSectionReader(file, offset, n)
|
||||
if !slices.IsSortedFunc(ggml.Tensors(), func(a, b *llm.Tensor) int {
|
||||
var i, j int
|
||||
if n, err := fmt.Sscanf(a.Name, "blk.%d", &i); err != nil || n != 1 {
|
||||
return cmp.Compare(a.Name, b.Name)
|
||||
} else if n, err := fmt.Sscanf(b.Name, "blk.%d", &j); err != nil || n != 1 {
|
||||
return cmp.Compare(a.Name, b.Name)
|
||||
}
|
||||
|
||||
return cmp.Compare(i, j)
|
||||
}) {
|
||||
if !sort.IsSorted(ggml.Tensors()) {
|
||||
reader = &llm.GGUFWriter{
|
||||
KV: ggml.KV(),
|
||||
T: ggml.Tensors(),
|
||||
KV: ggml.KV(),
|
||||
Tensors: ggml.Tensors(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user