fix: allow importing a model from name reference (#3005)

This commit is contained in:
Bruce MacDonald 2024-03-08 12:27:47 -05:00 committed by GitHub
parent 0e4669b04f
commit 0cebc79cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"log"
"log/slog"
"net/http"
@ -322,9 +323,12 @@ func CreateModel(ctx context.Context, name, modelFileDir string, commands []pars
ggufName, err := convertSafetensors(name, pathName)
if err != nil {
var pathErr *fs.PathError
switch {
case errors.Is(err, zip.ErrFormat):
// it's not a safetensor archive
case errors.As(err, &pathErr):
// it's not a file on disk, could be a model reference
default:
return err
}