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
14476d48
"vscode:/vscode.git/clone" did not exist on "79c380bc80051d8f82a38c3a7df6f8f4efd1633d"
Unverified
Commit
14476d48
authored
Apr 23, 2024
by
Patrick Devine
Committed by
GitHub
Apr 23, 2024
Browse files
fixes for gguf (#3863)
parent
ce8ce825
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
llm/gguf.go
llm/gguf.go
+10
-6
No files found.
llm/gguf.go
View file @
14476d48
...
@@ -190,8 +190,6 @@ func (llm *gguf) Decode(rs io.ReadSeeker) error {
...
@@ -190,8 +190,6 @@ func (llm *gguf) Decode(rs io.ReadSeeker) error {
llm
.
kv
[
k
]
=
v
llm
.
kv
[
k
]
=
v
}
}
slog
.
Debug
(
fmt
.
Sprintf
(
"general.architecture = %s"
,
llm
.
kv
[
"general.architecture"
]))
// decode tensors
// decode tensors
for
i
:=
0
;
uint64
(
i
)
<
llm
.
numTensor
();
i
++
{
for
i
:=
0
;
uint64
(
i
)
<
llm
.
numTensor
();
i
++
{
name
,
err
:=
readGGUFString
(
llm
,
rs
)
name
,
err
:=
readGGUFString
(
llm
,
rs
)
...
@@ -465,11 +463,13 @@ var ggufKVOrder = map[string][]string{
...
@@ -465,11 +463,13 @@ var ggufKVOrder = map[string][]string{
"llama.embedding_length"
,
"llama.embedding_length"
,
"llama.block_count"
,
"llama.block_count"
,
"llama.feed_forward_length"
,
"llama.feed_forward_length"
,
"llama.rope.dimension_count"
,
"llama.attention.head_count"
,
"llama.attention.head_count"
,
"llama.attention.head_count_kv"
,
"llama.attention.head_count_kv"
,
"llama.attention.layer_norm_rms_epsilon"
,
"llama.attention.layer_norm_rms_epsilon"
,
"llama.rope.freq_base"
,
"llama.rope.freq_base"
,
"llama.rope.dimension_count"
,
"llama.expert_count"
,
"llama.expert_used_count"
,
"gemma.context_length"
,
"gemma.context_length"
,
"gemma.embedding_length"
,
"gemma.embedding_length"
,
"gemma.block_count"
,
"gemma.block_count"
,
...
@@ -577,6 +577,8 @@ func (llm *gguf) Encode(ws io.WriteSeeker, kv KV, tensors []Tensor) error {
...
@@ -577,6 +577,8 @@ func (llm *gguf) Encode(ws io.WriteSeeker, kv KV, tensors []Tensor) error {
return
err
return
err
}
}
}
}
default
:
return
fmt
.
Errorf
(
"improper type for '%s'"
,
k
)
}
}
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -598,9 +600,11 @@ func (llm *gguf) Encode(ws io.WriteSeeker, kv KV, tensors []Tensor) error {
...
@@ -598,9 +600,11 @@ func (llm *gguf) Encode(ws io.WriteSeeker, kv KV, tensors []Tensor) error {
return
err
return
err
}
}
dims
:=
1
dims
:=
0
if
tensor
.
Shape
[
1
]
>
0
{
for
cnt
:=
0
;
cnt
<
len
(
tensor
.
Shape
);
cnt
++
{
dims
=
2
if
tensor
.
Shape
[
cnt
]
>
0
{
dims
++
}
}
}
if
err
:=
binary
.
Write
(
ws
,
llm
.
ByteOrder
,
uint32
(
dims
));
err
!=
nil
{
if
err
:=
binary
.
Write
(
ws
,
llm
.
ByteOrder
,
uint32
(
dims
));
err
!=
nil
{
...
...
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