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
ce3eb0a3
Unverified
Commit
ce3eb0a3
authored
Nov 03, 2025
by
Michael Yang
Committed by
GitHub
Nov 03, 2025
Browse files
chore(gptoss): cleanup dead code (#12932)
parent
60829f7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
model/models/gptoss/model.go
model/models/gptoss/model.go
+4
-5
No files found.
model/models/gptoss/model.go
View file @
ce3eb0a3
...
...
@@ -32,7 +32,6 @@ func (m *Transformer) Forward(ctx ml.Context, batch input.Batch) (ml.Tensor, err
hiddenStates
:=
m
.
TokenEmbedding
.
Forward
(
ctx
,
batch
.
Inputs
)
positions
:=
ctx
.
Input
()
.
FromInts
(
batch
.
Positions
,
len
(
batch
.
Positions
))
one
:=
ctx
.
Input
()
.
FromFloats
([]
float32
{
1
},
1
)
for
i
,
block
:=
range
m
.
TransformerBlocks
{
m
.
Cache
.
SetLayer
(
i
)
if
c
,
ok
:=
m
.
Cache
.
(
*
kvcache
.
WrapperCache
);
ok
{
...
...
@@ -45,7 +44,7 @@ func (m *Transformer) Forward(ctx ml.Context, batch input.Batch) (ml.Tensor, err
outputs
=
batch
.
Outputs
}
hiddenStates
=
block
.
Forward
(
ctx
,
hiddenStates
,
positions
,
outputs
,
one
,
m
.
Cache
,
&
m
.
Options
)
hiddenStates
=
block
.
Forward
(
ctx
,
hiddenStates
,
positions
,
outputs
,
m
.
Cache
,
&
m
.
Options
)
}
hiddenStates
=
m
.
OutputNorm
.
Forward
(
ctx
,
hiddenStates
,
m
.
eps
)
...
...
@@ -90,13 +89,13 @@ type TransformerBlock struct {
MLP
*
MLPBlock
}
func
(
d
*
TransformerBlock
)
Forward
(
ctx
ml
.
Context
,
hiddenStates
,
positions
,
outputs
,
one
ml
.
Tensor
,
cache
kvcache
.
Cache
,
opts
*
Options
)
ml
.
Tensor
{
func
(
d
*
TransformerBlock
)
Forward
(
ctx
ml
.
Context
,
hiddenStates
,
positions
,
outputs
ml
.
Tensor
,
cache
kvcache
.
Cache
,
opts
*
Options
)
ml
.
Tensor
{
hiddenStates
=
d
.
Attention
.
Forward
(
ctx
,
hiddenStates
,
positions
,
cache
,
opts
)
if
outputs
!=
nil
{
hiddenStates
=
hiddenStates
.
Rows
(
ctx
,
outputs
)
}
hiddenStates
=
d
.
MLP
.
Forward
(
ctx
,
hiddenStates
,
one
,
opts
)
hiddenStates
=
d
.
MLP
.
Forward
(
ctx
,
hiddenStates
,
opts
)
return
hiddenStates
}
...
...
@@ -177,7 +176,7 @@ type MLPBlock struct {
Down
*
nn
.
LinearBatch
`gguf:"ffn_down_exps"`
}
func
(
mlp
*
MLPBlock
)
Forward
(
ctx
ml
.
Context
,
hiddenStates
,
one
ml
.
Tensor
,
opts
*
Options
)
ml
.
Tensor
{
func
(
mlp
*
MLPBlock
)
Forward
(
ctx
ml
.
Context
,
hiddenStates
ml
.
Tensor
,
opts
*
Options
)
ml
.
Tensor
{
hiddenDim
,
sequenceLength
,
batchSize
:=
hiddenStates
.
Dim
(
0
),
hiddenStates
.
Dim
(
1
),
hiddenStates
.
Dim
(
2
)
residual
:=
hiddenStates
...
...
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