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
3c4ad0ec
Commit
3c4ad0ec
authored
Mar 15, 2024
by
Michael Yang
Browse files
dyn global
parent
22f32646
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
llm/dyn_ext_server.go
llm/dyn_ext_server.go
+2
-5
No files found.
llm/dyn_ext_server.go
View file @
3c4ad0ec
...
@@ -64,9 +64,6 @@ func extServerResponseToErr(resp C.ext_server_resp_t) error {
...
@@ -64,9 +64,6 @@ func extServerResponseToErr(resp C.ext_server_resp_t) error {
return
fmt
.
Errorf
(
C
.
GoString
(
resp
.
msg
))
return
fmt
.
Errorf
(
C
.
GoString
(
resp
.
msg
))
}
}
// Note: current implementation does not support concurrent instantiations
var
llm
*
dynExtServer
func
newDynExtServer
(
library
,
model
string
,
adapters
,
projectors
[]
string
,
opts
api
.
Options
)
(
LLM
,
error
)
{
func
newDynExtServer
(
library
,
model
string
,
adapters
,
projectors
[]
string
,
opts
api
.
Options
)
(
LLM
,
error
)
{
if
!
mutex
.
TryLock
()
{
if
!
mutex
.
TryLock
()
{
slog
.
Info
(
"concurrent llm servers not yet supported, waiting for prior server to complete"
)
slog
.
Info
(
"concurrent llm servers not yet supported, waiting for prior server to complete"
)
...
@@ -83,7 +80,7 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
...
@@ -83,7 +80,7 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
mutex
.
Unlock
()
mutex
.
Unlock
()
return
nil
,
fmt
.
Errorf
(
"Unable to load dynamic library: %s"
,
C
.
GoString
(
resp
.
msg
))
return
nil
,
fmt
.
Errorf
(
"Unable to load dynamic library: %s"
,
C
.
GoString
(
resp
.
msg
))
}
}
llm
=
&
dynExtServer
{
llm
:
=
dynExtServer
{
s
:
srv
,
s
:
srv
,
options
:
opts
,
options
:
opts
,
}
}
...
@@ -161,7 +158,7 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
...
@@ -161,7 +158,7 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
slog
.
Info
(
"Starting llama main loop"
)
slog
.
Info
(
"Starting llama main loop"
)
C
.
dyn_llama_server_start
(
llm
.
s
)
C
.
dyn_llama_server_start
(
llm
.
s
)
return
llm
,
nil
return
&
llm
,
nil
}
}
func
(
llm
*
dynExtServer
)
Predict
(
ctx
context
.
Context
,
predict
PredictOpts
,
fn
func
(
PredictResult
))
error
{
func
(
llm
*
dynExtServer
)
Predict
(
ctx
context
.
Context
,
predict
PredictOpts
,
fn
func
(
PredictResult
))
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