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
c3168935
Commit
c3168935
authored
Jul 07, 2023
by
Bruce MacDonald
Browse files
fix resume download
parent
3d73ad0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
cmd/cmd.go
cmd/cmd.go
+17
-21
No files found.
cmd/cmd.go
View file @
c3168935
...
@@ -43,27 +43,23 @@ func RunRun(cmd *cobra.Command, args []string) error {
...
@@ -43,27 +43,23 @@ func RunRun(cmd *cobra.Command, args []string) error {
}
}
func
pull
(
model
string
)
error
{
func
pull
(
model
string
)
error
{
// TODO: check if the local model is up to date with remote
client
:=
api
.
NewClient
()
_
,
err
:=
os
.
Stat
(
cacheDir
()
+
"/models/"
+
model
+
".bin"
)
var
bar
*
progressbar
.
ProgressBar
switch
{
return
client
.
Pull
(
case
errors
.
Is
(
err
,
os
.
ErrNotExist
)
:
context
.
Background
(),
client
:=
api
.
NewClient
()
&
api
.
PullRequest
{
Model
:
model
},
var
bar
*
progressbar
.
ProgressBar
func
(
progress
api
.
PullProgress
)
error
{
return
client
.
Pull
(
if
bar
==
nil
&&
progress
.
Percent
==
100
{
context
.
Background
(),
// already downloaded
&
api
.
PullRequest
{
Model
:
model
},
return
nil
func
(
progress
api
.
PullProgress
)
error
{
}
if
bar
==
nil
{
if
bar
==
nil
{
bar
=
progressbar
.
DefaultBytes
(
progress
.
Total
)
bar
=
progressbar
.
DefaultBytes
(
progress
.
Total
)
}
}
return
bar
.
Set64
(
progress
.
Completed
)
return
bar
.
Set64
(
progress
.
Completed
)
},
},
)
)
case
err
!=
nil
:
return
err
}
return
nil
}
}
func
RunGenerate
(
_
*
cobra
.
Command
,
args
[]
string
)
error
{
func
RunGenerate
(
_
*
cobra
.
Command
,
args
[]
string
)
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