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
5a739ff4
Commit
5a739ff4
authored
Jul 10, 2024
by
Michael Yang
Browse files
chatglm graph
parent
2d1e3c32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
llm/ggml.go
llm/ggml.go
+26
-0
No files found.
llm/ggml.go
View file @
5a739ff4
...
@@ -424,6 +424,32 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
...
@@ -424,6 +424,32 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
4
*
batch
*
(
3
*
embedding
+
vocab
)
+
embedding
*
vocab
*
105
/
128
,
4
*
batch
*
(
3
*
embedding
+
vocab
)
+
embedding
*
vocab
*
105
/
128
,
4
*
batch
*
(
2
*
embedding
+
1
+
2
*
embeddingHeadsK
*
headsKV
+
context
+
context
*
headsKV
)
+
4
*
embeddingHeadsK
*
context
*
headsKV
+
embedding
*
embeddingHeadsK
*
headsKV
*
9
/
16
,
4
*
batch
*
(
2
*
embedding
+
1
+
2
*
embeddingHeadsK
*
headsKV
+
context
+
context
*
headsKV
)
+
4
*
embeddingHeadsK
*
context
*
headsKV
+
embedding
*
embeddingHeadsK
*
headsKV
*
9
/
16
,
)
)
case
"chatglm"
:
fullOffload
=
4
*
batch
*
(
embedding
+
vocab
)
partialOffload
=
4
*
batch
*
(
embedding
+
vocab
)
+
embedding
*
vocab
*
105
/
128
if
qkvBias
,
ok
:=
layers
[
"blk.0"
][
"attn_qkv.bias"
];
ok
{
fullOffload
=
max
(
fullOffload
,
4
*
batch
*
(
2
+
2
*
embedding
+
context
+
context
*
heads
+
embeddingHeadsK
*
heads
+
qkvBias
.
Shape
[
0
]),
)
partialOffload
=
max
(
partialOffload
,
4
*
batch
*
(
1
+
2
*
embedding
+
embeddingHeadsK
*
heads
+
context
+
context
*
heads
)
+
4
*
embeddingHeadsK
*
context
+
4
*
context
*
embeddingHeadsK
+
4
*
qkvBias
.
Shape
[
0
],
)
}
}
}
return
return
...
...
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