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
23c64538
Commit
23c64538
authored
Jun 25, 2023
by
Jeffrey Morgan
Browse files
fix model lookup directory for other routes
parent
2db9c1bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
proto.py
proto.py
+4
-4
No files found.
proto.py
View file @
23c64538
...
...
@@ -18,11 +18,11 @@ def load():
if
not
model
:
return
Response
(
"Model is required"
,
status
=
400
)
if
not
os
.
path
.
exists
(
f
".
.
/models/
{
model
}
.bin"
):
if
not
os
.
path
.
exists
(
f
"./models/
{
model
}
.bin"
):
return
{
"error"
:
"The model does not exist."
},
400
if
model
not
in
llms
:
llms
[
model
]
=
Llama
(
model_path
=
f
".
.
/models/
{
model
}
.bin"
)
llms
[
model
]
=
Llama
(
model_path
=
f
"./models/
{
model
}
.bin"
)
return
Response
(
status
=
204
)
...
...
@@ -34,7 +34,7 @@ def unload():
if
not
model
:
return
Response
(
"Model is required"
,
status
=
400
)
if
not
os
.
path
.
exists
(
f
".
.
/models/
{
model
}
.bin"
):
if
not
os
.
path
.
exists
(
f
"./models/
{
model
}
.bin"
):
return
{
"error"
:
"The model does not exist."
},
400
llms
.
pop
(
model
,
None
)
...
...
@@ -57,7 +57,7 @@ def generate():
if
model
not
in
llms
:
# auto load
llms
[
model
]
=
Llama
(
model_path
=
f
".
.
/models/
{
model
}
.bin"
)
llms
[
model
]
=
Llama
(
model_path
=
f
"./models/
{
model
}
.bin"
)
def
stream_response
():
stream
=
llms
[
model
](
...
...
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