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
c00fa9cc
Commit
c00fa9cc
authored
Oct 06, 2025
by
Michael Yang
Committed by
Michael Yang
Oct 10, 2025
Browse files
convert: split gate_up bias
parent
df411c4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
convert/convert_gptoss.go
convert/convert_gptoss.go
+11
-0
convert/tensor.go
convert/tensor.go
+8
-4
No files found.
convert/convert_gptoss.go
View file @
c00fa9cc
...
...
@@ -85,6 +85,17 @@ func (m *gptossModel) Tensors(ts []Tensor) []*ggml.Tensor {
case
"scales"
:
mxfp4s
[
name
]
.
scales
=
t
}
}
else
if
strings
.
HasSuffix
(
t
.
Name
(),
"gate_up_exps.bias"
)
{
out
=
append
(
out
,
slices
.
Collect
(
splitDim
(
t
,
1
,
split
{
Replacer
:
strings
.
NewReplacer
(
"gate_up_exps"
,
"gate_exps"
),
slices
:
[]
tensor
.
Slice
{
nil
,
tensor
.
S
(
0
,
int
(
t
.
Shape
()[
1
]),
2
)},
},
split
{
Replacer
:
strings
.
NewReplacer
(
"gate_up_exps"
,
"up_exps"
),
slices
:
[]
tensor
.
Slice
{
nil
,
tensor
.
S
(
1
,
int
(
t
.
Shape
()[
1
]),
2
)},
},
))
...
)
}
else
{
out
=
append
(
out
,
&
ggml
.
Tensor
{
Name
:
t
.
Name
(),
...
...
convert/tensor.go
View file @
c00fa9cc
...
...
@@ -16,7 +16,8 @@ import (
type
split
struct
{
*
strings
.
Replacer
dim
int
dim
int
slices
[]
tensor
.
Slice
// fn is an optional function to apply to the tensor after slicing
fn
func
(
tensor
.
Tensor
)
(
tensor
.
Tensor
,
error
)
...
...
@@ -32,9 +33,12 @@ func splitDim(t Tensor, dim int, splits ...split) iter.Seq[*ggml.Tensor] {
shape
:=
slices
.
Clone
(
t
.
Shape
())
shape
[
dim
]
=
cmp
.
Or
(
uint64
(
split
.
dim
),
shape
[
dim
]
/
uint64
(
len
(
splits
)))
slice
:=
slices
.
Repeat
([]
tensor
.
Slice
{
nil
},
len
(
shape
))
slice
[
dim
]
=
tensor
.
S
(
offset
,
offset
+
int
(
shape
[
dim
]))
offset
+=
int
(
shape
[
dim
])
slice
:=
split
.
slices
if
len
(
slice
)
==
0
{
slice
:=
slices
.
Repeat
([]
tensor
.
Slice
{
nil
},
len
(
shape
))
slice
[
dim
]
=
tensor
.
S
(
offset
,
offset
+
int
(
shape
[
dim
]))
offset
+=
int
(
shape
[
dim
])
}
t
.
SetRepacker
(
func
(
_
string
,
data
[]
float32
,
shape
[]
uint64
)
([]
float32
,
error
)
{
dims
:=
make
([]
int
,
len
(
shape
))
...
...
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