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
"vscode:/vscode.git/clone" did not exist on "23ebbb4bc81a17ebea17cb7cb94f301199e49a7f"
Commit
c3168935
authored
Jul 07, 2023
by
Bruce MacDonald
Browse files
fix resume download
parent
3d73ad0c
Changes
1
Show 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,16 +43,16 @@ func RunRun(cmd *cobra.Command, args []string) error {
...
@@ -43,16 +43,16 @@ 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
_
,
err
:=
os
.
Stat
(
cacheDir
()
+
"/models/"
+
model
+
".bin"
)
switch
{
case
errors
.
Is
(
err
,
os
.
ErrNotExist
)
:
client
:=
api
.
NewClient
()
client
:=
api
.
NewClient
()
var
bar
*
progressbar
.
ProgressBar
var
bar
*
progressbar
.
ProgressBar
return
client
.
Pull
(
return
client
.
Pull
(
context
.
Background
(),
context
.
Background
(),
&
api
.
PullRequest
{
Model
:
model
},
&
api
.
PullRequest
{
Model
:
model
},
func
(
progress
api
.
PullProgress
)
error
{
func
(
progress
api
.
PullProgress
)
error
{
if
bar
==
nil
&&
progress
.
Percent
==
100
{
// already downloaded
return
nil
}
if
bar
==
nil
{
if
bar
==
nil
{
bar
=
progressbar
.
DefaultBytes
(
progress
.
Total
)
bar
=
progressbar
.
DefaultBytes
(
progress
.
Total
)
}
}
...
@@ -60,10 +60,6 @@ func pull(model string) error {
...
@@ -60,10 +60,6 @@ func pull(model string) error {
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