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
786f3a1c
Unverified
Commit
786f3a1c
authored
Apr 11, 2024
by
Michael Yang
Committed by
GitHub
Apr 11, 2024
Browse files
Merge pull request #3600 from ollama/mxyng/mixtral
parents
0efb7931
3397eff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
llm/ggml.go
llm/ggml.go
+12
-1
No files found.
llm/ggml.go
View file @
786f3a1c
...
...
@@ -330,6 +330,8 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
headsKV
:=
llm
.
KV
()
.
HeadCountKV
()
vocab
:=
uint64
(
len
(
llm
.
KV
()[
"tokenizer.ggml.tokens"
]
.
([]
any
)))
layers
:=
llm
.
Tensors
()
.
Layers
()
switch
llm
.
KV
()
.
Architecture
()
{
case
"llama"
:
fullOffload
=
4
*
batch
*
(
1
+
4
*
embedding
+
context
*
(
1
+
heads
))
...
...
@@ -339,6 +341,15 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
4
*
batch
*
(
1
+
embedding
+
max
(
context
,
embedding
))
+
embedding
*
embedding
*
9
/
16
+
4
*
context
*
(
batch
*
heads
+
embedding
/
heads
*
headsKV
),
4
*
batch
*
(
embedding
+
vocab
)
+
embedding
*
vocab
*
105
/
128
,
)
if
ffnGateWeight
,
ok
:=
layers
[
"0"
][
"ffn_gate.0.weight"
];
ok
{
ffnGateWeight1
:=
ffnGateWeight
.
Shape
[
1
]
fullOffload
=
4
*
batch
*
(
2
+
3
*
embedding
+
context
*
(
1
+
heads
)
+
2
*
headsKV
+
ffnGateWeight1
)
partialOffload
=
max
(
4
*
batch
*
(
3
+
embedding
/
heads
*
headsKV
+
embedding
+
context
*
(
1
+
heads
)
+
ffnGateWeight1
)
+
(
embedding
*
embedding
+
3
*
embedding
*
headsKV
*
ffnGateWeight1
)
*
9
/
16
,
4
*
batch
*
(
1
+
2
*
embedding
+
context
*
(
1
+
heads
))
+
embedding
*
(
6
*
context
*
headsKV
/
heads
+
embedding
*
9
/
16
),
)
}
case
"gemma"
:
fullOffload
=
4
*
batch
*
(
embedding
+
vocab
)
partialOffload
=
4
*
batch
*
(
2
*
embedding
+
vocab
+
1
)
+
embedding
*
vocab
*
105
/
128
...
...
@@ -350,7 +361,7 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
partialOffload
=
max
(
4
*
batch
*
(
embedding
+
vocab
)
+
embedding
*
vocab
*
105
/
128
,
4
*
batch
*
(
1
+
2
*
embedding
+
context
*
(
1
+
heads
))
+
4
*
embedding
*
context
+
embedding
*
embedding
*
9
/
16
,
4
*
batch
*
(
1
+
2
*
embedding
+
context
*
(
1
+
heads
))
+
4
*
embedding
*
context
+
embedding
*
embedding
*
9
/
16
,
)
case
"qwen2"
:
fullOffload
=
max
(
...
...
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