Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
7e8f7c83
Unverified
Commit
7e8f7c83
authored
Jan 08, 2024
by
Bruce MacDonald
Committed by
GitHub
Jan 08, 2024
Browse files
remove ggml automatic re-pull (#1856)
parent
3f3eb19a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
41 deletions
+1
-41
cmd/cmd.go
cmd/cmd.go
+1
-15
server/images.go
server/images.go
+0
-26
No files found.
cmd/cmd.go
View file @
7e8f7c83
...
...
@@ -149,7 +149,7 @@ func RunHandler(cmd *cobra.Command, args []string) error {
name
:=
args
[
0
]
// check if the model exists on the server
model
,
err
:
=
client
.
Show
(
cmd
.
Context
(),
&
api
.
ShowRequest
{
Name
:
name
})
_
,
err
=
client
.
Show
(
cmd
.
Context
(),
&
api
.
ShowRequest
{
Name
:
name
})
var
statusError
api
.
StatusError
switch
{
case
errors
.
As
(
err
,
&
statusError
)
&&
statusError
.
StatusCode
==
http
.
StatusNotFound
:
...
...
@@ -158,20 +158,6 @@ func RunHandler(cmd *cobra.Command, args []string) error {
}
case
err
!=
nil
:
return
err
default
:
// the model was found, check if it is in the correct format
if
model
.
Details
.
Format
!=
""
&&
model
.
Details
.
Format
!=
"gguf"
{
// pull and retry to see if the model has been updated
parts
:=
strings
.
Split
(
name
,
string
(
os
.
PathSeparator
))
if
len
(
parts
)
==
1
{
// this is a library model, log some info
fmt
.
Fprintln
(
os
.
Stderr
,
"This model is no longer compatible with Ollama. Pulling a new version..."
)
}
if
err
:=
PullHandler
(
cmd
,
[]
string
{
name
});
err
!=
nil
{
fmt
.
Printf
(
"Error: %s
\n
"
,
err
)
return
fmt
.
Errorf
(
"unsupported model, please update this model to gguf format"
)
// relay the original error
}
}
}
return
RunGenerate
(
cmd
,
args
)
...
...
server/images.go
View file @
7e8f7c83
...
...
@@ -478,32 +478,6 @@ func CreateModel(ctx context.Context, name, modelFileDir string, commands []pars
return
err
}
// if the model is not in gguf format, pull the base model to try and get it in gguf format
if
fromConfig
.
ModelFormat
!=
"gguf"
{
fn
(
api
.
ProgressResponse
{
Status
:
"updating base model"
})
parent
,
err
:=
GetModel
(
c
.
Args
)
if
err
!=
nil
{
return
err
}
originalModel
:=
parent
.
OriginalModel
if
originalModel
==
""
{
originalModel
=
parent
.
ShortName
}
if
err
:=
PullModel
(
ctx
,
originalModel
,
&
RegistryOptions
{},
fn
);
err
!=
nil
{
log
.
Printf
(
"error pulling parent model: %v"
,
err
)
}
// Reset the file pointer to the beginning of the file
_
,
err
=
fromConfigFile
.
Seek
(
0
,
0
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"update from config after pull: %w"
,
err
)
}
if
err
:=
json
.
NewDecoder
(
fromConfigFile
)
.
Decode
(
&
fromConfig
);
err
!=
nil
{
return
err
}
}
// if the model is still not in gguf format, error out
if
fromConfig
.
ModelFormat
!=
"gguf"
{
return
fmt
.
Errorf
(
"%s is not in gguf format, this base model is not compatible with this version of ollama"
,
c
.
Args
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment