fix: allow importing a model from name reference (#3005)
This commit is contained in:
parent
0e4669b04f
commit
0cebc79cba
1 changed files with 4 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -322,9 +323,12 @@ func CreateModel(ctx context.Context, name, modelFileDir string, commands []pars
|
||||||
|
|
||||||
ggufName, err := convertSafetensors(name, pathName)
|
ggufName, err := convertSafetensors(name, pathName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
var pathErr *fs.PathError
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, zip.ErrFormat):
|
case errors.Is(err, zip.ErrFormat):
|
||||||
// it's not a safetensor archive
|
// it's not a safetensor archive
|
||||||
|
case errors.As(err, &pathErr):
|
||||||
|
// it's not a file on disk, could be a model reference
|
||||||
default:
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue