Merge pull request #146 from jmorganca/fix-windows-pull

windows: fix model pulling
This commit is contained in:
Michael Yang 2023-07-20 13:41:54 -07:00 committed by GitHub
commit 0cfdbb95cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -854,6 +854,10 @@ func downloadBlob(mp ModelPath, digest string, username, password string, fn fun
})
if completed >= total {
if err := out.Close(); err != nil {
return err
}
if err := os.Rename(fp+"-partial", fp); err != nil {
fn(api.ProgressResponse{
Status: fmt.Sprintf("error renaming file: %v", err),

View file

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
)
@ -106,6 +107,10 @@ func GetBlobsPath(digest string) (string, error) {
return "", err
}
if runtime.GOOS == "windows" {
digest = strings.ReplaceAll(digest, ":", "-")
}
path := filepath.Join(home, ".ollama", "models", "blobs", digest)
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
return "", err