diff --git a/cmd/cmd.go b/cmd/cmd.go index b285f83cb..05acaa0da 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -6,7 +6,6 @@ import ( "context" "crypto/ed25519" "crypto/rand" - "crypto/sha256" "encoding/pem" "errors" "fmt" @@ -24,6 +23,8 @@ import ( "syscall" "time" + "github.com/minio/sha256-simd" + "github.com/containerd/console" "github.com/mattn/go-runewidth" "github.com/olekukonko/tablewriter" diff --git a/convert/tokenizer.go b/convert/tokenizer.go index efeb5491f..effc51c49 100644 --- a/convert/tokenizer.go +++ b/convert/tokenizer.go @@ -2,13 +2,14 @@ package convert import ( "cmp" - "crypto/sha256" "encoding/json" "fmt" "log/slog" "os" "slices" + "github.com/minio/sha256-simd" + "golang.org/x/exp/maps" ) diff --git a/go.mod b/go.mod index 2f3d4ca34..60d751241 100644 --- a/go.mod +++ b/go.mod @@ -33,6 +33,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/kr/text v0.2.0 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect diff --git a/go.sum b/go.sum index 9e1baebe0..1991d948e 100644 --- a/go.sum +++ b/go.sum @@ -135,6 +135,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/llm/llama.cpp b/llm/llama.cpp index 5921b8f08..74f33adf5 160000 --- a/llm/llama.cpp +++ b/llm/llama.cpp @@ -1 +1 @@ -Subproject commit 5921b8f089d3b7bda86aac5a66825df6a6c10603 +Subproject commit 74f33adf5f8b20b08fc5a6aa17ce081abe86ef2f diff --git a/server/auth.go b/server/auth.go index e92a5b657..3e9d67b3c 100644 --- a/server/auth.go +++ b/server/auth.go @@ -3,7 +3,6 @@ package server import ( "context" "crypto/rand" - "crypto/sha256" "encoding/base64" "encoding/hex" "encoding/json" @@ -15,6 +14,8 @@ import ( "strings" "time" + "github.com/minio/sha256-simd" + "github.com/ollama/ollama/api" "github.com/ollama/ollama/auth" ) diff --git a/server/images.go b/server/images.go index 9254671c8..6dc34b7a5 100644 --- a/server/images.go +++ b/server/images.go @@ -4,7 +4,6 @@ import ( "bytes" "cmp" "context" - "crypto/sha256" "encoding/base64" "encoding/hex" "encoding/json" @@ -21,14 +20,16 @@ import ( "strconv" "strings" + "github.com/minio/sha256-simd" + "golang.org/x/exp/slices" "github.com/ollama/ollama/api" "github.com/ollama/ollama/auth" + "github.com/ollama/ollama/envconfig" "github.com/ollama/ollama/format" "github.com/ollama/ollama/llm" "github.com/ollama/ollama/parser" - "github.com/ollama/ollama/envconfig" "github.com/ollama/ollama/types/errtypes" "github.com/ollama/ollama/types/model" "github.com/ollama/ollama/version" diff --git a/server/layer.go b/server/layer.go index cc6709d24..0ec51ea99 100644 --- a/server/layer.go +++ b/server/layer.go @@ -1,10 +1,11 @@ package server import ( - "crypto/sha256" "fmt" "io" "os" + + "github.com/minio/sha256-simd" ) type Layer struct { diff --git a/server/manifest.go b/server/manifest.go index a52512980..9da53b4e0 100644 --- a/server/manifest.go +++ b/server/manifest.go @@ -2,7 +2,6 @@ package server import ( "bytes" - "crypto/sha256" "encoding/json" "fmt" "io" @@ -10,6 +9,8 @@ import ( "os" "path/filepath" + "github.com/minio/sha256-simd" + "github.com/ollama/ollama/types/model" )