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
26d0bf92
Unverified
Commit
26d0bf92
authored
Jun 18, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jun 18, 2024
Browse files
Merge pull request #5117 from dhiltgen/fix_prediction
Handle models with divergent layer sizes
parents
b55958a5
359b15a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
llm/memory.go
llm/memory.go
+6
-0
No files found.
llm/memory.go
View file @
26d0bf92
package
llm
package
llm
import
(
import
(
"fmt"
"log/slog"
"log/slog"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -179,6 +180,11 @@ func EstimateGPULayers(gpus []gpu.GpuInfo, ggml *GGML, projectors []string, opts
...
@@ -179,6 +180,11 @@ func EstimateGPULayers(gpus []gpu.GpuInfo, ggml *GGML, projectors []string, opts
// For all the layers, find where they can fit on the GPU(s)
// For all the layers, find where they can fit on the GPU(s)
for
i
:=
range
int
(
ggml
.
KV
()
.
BlockCount
())
{
for
i
:=
range
int
(
ggml
.
KV
()
.
BlockCount
())
{
// Some models have inconsistent layer sizes
if
blk
,
ok
:=
layers
[
fmt
.
Sprintf
(
"blk.%d"
,
i
)];
ok
{
layerSize
=
blk
.
size
()
layerSize
+=
kv
/
ggml
.
KV
()
.
BlockCount
()
}
memoryWeights
+=
layerSize
memoryWeights
+=
layerSize
if
opts
.
NumGPU
>=
0
&&
layerCount
>=
opts
.
NumGPU
{
if
opts
.
NumGPU
>=
0
&&
layerCount
>=
opts
.
NumGPU
{
...
...
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