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
69f392c9
Unverified
Commit
69f392c9
authored
Feb 07, 2024
by
Daniel Hiltgen
Committed by
GitHub
Feb 07, 2024
Browse files
Merge pull request #2403 from dhiltgen/handle_tmp_cleanup
Ensure the libraries are present
parents
a0a199b1
a1dfab43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
llm/llm.go
llm/llm.go
+12
-2
No files found.
llm/llm.go
View file @
69f392c9
...
...
@@ -120,7 +120,7 @@ func New(workDir, model string, adapters, projectors []string, opts api.Options)
opts
.
RopeFrequencyBase
=
0.0
opts
.
RopeFrequencyScale
=
0.0
return
newLlmServer
(
info
,
model
,
adapters
,
projectors
,
opts
)
return
newLlmServer
(
info
,
workDir
,
model
,
adapters
,
projectors
,
opts
)
}
// Give any native cgo implementations an opportunity to initialize
...
...
@@ -128,7 +128,7 @@ func Init(workdir string) error {
return
nativeInit
(
workdir
)
}
func
newLlmServer
(
gpuInfo
gpu
.
GpuInfo
,
model
string
,
adapters
,
projectors
[]
string
,
opts
api
.
Options
)
(
LLM
,
error
)
{
func
newLlmServer
(
gpuInfo
gpu
.
GpuInfo
,
workDir
,
model
string
,
adapters
,
projectors
[]
string
,
opts
api
.
Options
)
(
LLM
,
error
)
{
dynLibs
:=
getDynLibs
(
gpuInfo
)
// Check to see if the user has requested a specific library instead of auto-detecting
...
...
@@ -143,6 +143,16 @@ func newLlmServer(gpuInfo gpu.GpuInfo, model string, adapters, projectors []stri
}
}
// We stage into a temp directory, and if we've been idle for a while, it may have been reaped
_
,
err
:=
os
.
Stat
(
dynLibs
[
0
])
if
err
!=
nil
{
slog
.
Info
(
fmt
.
Sprintf
(
"%s has disappeared, reloading libraries"
,
dynLibs
[
0
]))
err
=
nativeInit
(
workDir
)
if
err
!=
nil
{
return
nil
,
err
}
}
err2
:=
fmt
.
Errorf
(
"unable to locate suitable llm library"
)
for
_
,
dynLib
:=
range
dynLibs
{
srv
,
err
:=
newDynExtServer
(
dynLib
,
model
,
adapters
,
projectors
,
opts
)
...
...
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