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
orangecat
ollama
Commits
23c64538
"git@developer.sourcefind.cn:zhaoyu6/sglang.git" did not exist on "2e1d2d7e66c33fdd2b58aaf03a9893dbe593a3a3"
Commit
23c64538
authored
Jun 25, 2023
by
Jeffrey Morgan
Browse files
fix model lookup directory for other routes
parent
2db9c1bb
Changes
1
Show 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():
...
@@ -18,11 +18,11 @@ def load():
if
not
model
:
if
not
model
:
return
Response
(
"Model is required"
,
status
=
400
)
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
return
{
"error"
:
"The model does not exist."
},
400
if
model
not
in
llms
:
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
)
return
Response
(
status
=
204
)
...
@@ -34,7 +34,7 @@ def unload():
...
@@ -34,7 +34,7 @@ def unload():
if
not
model
:
if
not
model
:
return
Response
(
"Model is required"
,
status
=
400
)
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
return
{
"error"
:
"The model does not exist."
},
400
llms
.
pop
(
model
,
None
)
llms
.
pop
(
model
,
None
)
...
@@ -57,7 +57,7 @@ def generate():
...
@@ -57,7 +57,7 @@ def generate():
if
model
not
in
llms
:
if
model
not
in
llms
:
# auto load
# auto load
llms
[
model
]
=
Llama
(
model_path
=
f
".
.
/models/
{
model
}
.bin"
)
llms
[
model
]
=
Llama
(
model_path
=
f
"./models/
{
model
}
.bin"
)
def
stream_response
():
def
stream_response
():
stream
=
llms
[
model
](
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