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
3a9f4471
Unverified
Commit
3a9f4471
authored
Jan 05, 2024
by
Bruce MacDonald
Committed by
GitHub
Jan 05, 2024
Browse files
only pull gguf model if already exists (#1817)
parent
9c2941e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
cmd/cmd.go
cmd/cmd.go
+13
-12
No files found.
cmd/cmd.go
View file @
3a9f4471
...
...
@@ -158,18 +158,19 @@ func RunHandler(cmd *cobra.Command, args []string) error {
}
case
err
!=
nil
:
return
err
}
if
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
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
}
}
}
...
...
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