"git@developer.sourcefind.cn:OpenDAS/ktransformers.git" did not exist on "af9472b5180ce46d3bd907b57a00c076f41ac160"
Commit 6cea2061 authored by Michael Yang's avatar Michael Yang
Browse files

windows: fix model pulling

parent 2832801c
...@@ -854,6 +854,10 @@ func downloadBlob(mp ModelPath, digest string, username, password string, fn fun ...@@ -854,6 +854,10 @@ func downloadBlob(mp ModelPath, digest string, username, password string, fn fun
}) })
if completed >= total { if completed >= total {
if err := out.Close(); err != nil {
return err
}
if err := os.Rename(fp+"-partial", fp); err != nil { if err := os.Rename(fp+"-partial", fp); err != nil {
fn(api.ProgressResponse{ fn(api.ProgressResponse{
Status: fmt.Sprintf("error renaming file: %v", err), Status: fmt.Sprintf("error renaming file: %v", err),
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
) )
...@@ -106,6 +107,10 @@ func GetBlobsPath(digest string) (string, error) { ...@@ -106,6 +107,10 @@ func GetBlobsPath(digest string) (string, error) {
return "", err return "", err
} }
if runtime.GOOS == "windows" {
digest = strings.ReplaceAll(digest, ":", "-")
}
path := filepath.Join(home, ".ollama", "models", "blobs", digest) path := filepath.Join(home, ".ollama", "models", "blobs", digest)
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
return "", err return "", err
......
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