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
92ca2cca
Commit
92ca2cca
authored
May 10, 2024
by
jmorganca
Browse files
Revert "only forward some env vars"
This reverts commit
ce3b212d
.
parent
1e1634da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
llm/server.go
llm/server.go
+20
-14
No files found.
llm/server.go
View file @
92ca2cca
...
@@ -288,25 +288,31 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
...
@@ -288,25 +288,31 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
done
:
make
(
chan
error
,
1
),
done
:
make
(
chan
error
,
1
),
}
}
s
.
cmd
.
Env
=
os
.
Environ
()
s
.
cmd
.
Stdout
=
os
.
Stdout
s
.
cmd
.
Stdout
=
os
.
Stdout
s
.
cmd
.
Stderr
=
s
.
status
s
.
cmd
.
Stderr
=
s
.
status
if
v
:=
strings
.
Join
(
libraryPaths
,
string
(
filepath
.
ListSeparator
));
v
!=
""
{
visibleDevicesEnv
,
visibleDevicesEnvVal
:=
gpu
.
GpuInfoList
(
gpus
)
.
GetVisibleDevicesEnv
()
s
.
cmd
.
Env
=
append
(
s
.
cmd
.
Env
,
pathEnv
+
"="
+
v
)
pathEnvVal
:=
strings
.
Join
(
libraryPaths
,
string
(
filepath
.
ListSeparator
))
// Update or add the path and visible devices variable with our adjusted version
pathNeeded
:=
true
devicesNeeded
:=
visibleDevicesEnv
!=
""
for
i
:=
range
s
.
cmd
.
Env
{
cmp
:=
strings
.
SplitN
(
s
.
cmd
.
Env
[
i
],
"="
,
2
)
if
strings
.
EqualFold
(
cmp
[
0
],
pathEnv
)
{
s
.
cmd
.
Env
[
i
]
=
pathEnv
+
"="
+
pathEnvVal
pathNeeded
=
false
}
else
if
devicesNeeded
&&
strings
.
EqualFold
(
cmp
[
0
],
visibleDevicesEnv
)
{
s
.
cmd
.
Env
[
i
]
=
visibleDevicesEnv
+
"="
+
visibleDevicesEnvVal
devicesNeeded
=
false
}
}
}
if
pathNeeded
{
if
k
,
v
:=
gpu
.
GpuInfoList
(
gpus
)
.
GetVisibleDevicesEnv
();
k
!=
""
{
s
.
cmd
.
Env
=
append
(
s
.
cmd
.
Env
,
pathEnv
+
"="
+
pathEnvVal
)
s
.
cmd
.
Env
=
append
(
s
.
cmd
.
Env
,
k
+
"="
+
v
)
}
}
if
devicesNeeded
{
for
_
,
ev
:=
range
os
.
Environ
()
{
s
.
cmd
.
Env
=
append
(
s
.
cmd
.
Env
,
visibleDevicesEnv
+
"="
+
visibleDevicesEnvVal
)
if
strings
.
HasPrefix
(
ev
,
"CUDA_"
)
||
strings
.
HasPrefix
(
ev
,
"ROCM_"
)
||
strings
.
HasPrefix
(
ev
,
"HIP_"
)
||
strings
.
HasPrefix
(
ev
,
"HSA_"
)
||
strings
.
HasPrefix
(
ev
,
"GGML_"
)
{
s
.
cmd
.
Env
=
append
(
s
.
cmd
.
Env
,
ev
)
}
}
}
slog
.
Info
(
"starting llama server"
,
"cmd"
,
s
.
cmd
.
String
())
slog
.
Info
(
"starting llama server"
,
"cmd"
,
s
.
cmd
.
String
())
...
...
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