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
27ead750
Commit
27ead750
authored
Jul 04, 2023
by
Bruce MacDonald
Browse files
try next runner if load fails
parent
a86a4f8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
ollama/engine.py
ollama/engine.py
+12
-6
No files found.
ollama/engine.py
View file @
27ead750
...
@@ -39,12 +39,18 @@ def load(model_name, models={}):
...
@@ -39,12 +39,18 @@ def load(model_name, models={}):
for
model_type
in
cls
.
model_types
()
for
model_type
in
cls
.
model_types
()
}
}
best_match
,
_
=
process
.
extractOne
(
model_path
,
runners
.
keys
())
while
len
(
runners
)
>
0
:
model
=
runners
.
get
(
best_match
,
LlamaCppRunner
)
try
:
best_match
,
_
=
process
.
extractOne
(
model_path
,
runners
.
keys
())
models
.
update
({
model_name
:
model
(
model_path
,
best_match
)})
model
=
runners
.
get
(
best_match
,
LlamaCppRunner
)
runner
=
model
(
model_path
,
best_match
)
return
models
.
get
(
model_name
)
models
.
update
({
model_name
:
runner
})
return
models
.
get
(
model_name
)
except
Exception
:
# try the next runner
runners
.
pop
(
best_match
)
raise
Exception
(
"failed to load model"
,
model_path
,
model_name
)
def
unload
(
model_name
,
models
=
{}):
def
unload
(
model_name
,
models
=
{}):
...
...
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