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
2dfb7441
Unverified
Commit
2dfb7441
authored
Dec 11, 2025
by
Jeffrey Morgan
Committed by
GitHub
Dec 11, 2025
Browse files
model: fix rotary embeddings for ministral 3 (#13432)
parent
1eb5e759
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
12 deletions
+1
-12
model/models/mistral3/model_text.go
model/models/mistral3/model_text.go
+1
-12
No files found.
model/models/mistral3/model_text.go
View file @
2dfb7441
...
@@ -29,24 +29,13 @@ type TextOptions struct {
...
@@ -29,24 +29,13 @@ type TextOptions struct {
func
(
o
TextOptions
)
applyRotaryPositionEmbeddings
(
ctx
ml
.
Context
,
states
,
positions
ml
.
Tensor
)
ml
.
Tensor
{
func
(
o
TextOptions
)
applyRotaryPositionEmbeddings
(
ctx
ml
.
Context
,
states
,
positions
ml
.
Tensor
)
ml
.
Tensor
{
var
ropeOpts
[]
func
(
*
rope
.
Options
)
var
ropeOpts
[]
func
(
*
rope
.
Options
)
if
o
.
ropeType
==
"yarn"
{
if
o
.
ropeType
==
"yarn"
{
getMscale
:=
func
(
scale
,
mscale
float64
)
float64
{
if
scale
<=
1.0
{
return
1.0
}
return
0.1
*
mscale
*
math
.
Log
(
scale
)
+
1.0
}
var
attnFactor
float32
if
o
.
ropeMscale
!=
0
&&
o
.
ropeMscaleAllDim
!=
0
{
if
o
.
ropeMscale
!=
0
&&
o
.
ropeMscaleAllDim
!=
0
{
attnFactor
=
float32
(
getMscale
(
float64
(
o
.
ropeScale
),
float64
(
o
.
ropeMscale
))
/
getMscale
(
float64
(
o
.
ropeScale
),
float64
(
o
.
ropeMscaleAllDim
)))
ropeOpts
=
append
(
ropeOpts
,
rope
.
WithAttentionFactor
(
1.0
/
float32
(
0.1
*
math
.
Log
(
float64
(
o
.
ropeScale
))
+
1.0
)))
}
else
{
attnFactor
=
float32
(
getMscale
(
float64
(
o
.
ropeScale
),
1
))
}
}
ropeOpts
=
append
(
ropeOpts
,
ropeOpts
=
append
(
ropeOpts
,
rope
.
WithOriginalContextLength
(
o
.
ropeOrigPosEmbeddings
),
rope
.
WithOriginalContextLength
(
o
.
ropeOrigPosEmbeddings
),
rope
.
WithExtrapolationFactor
(
o
.
ropeExtrapolation
),
rope
.
WithExtrapolationFactor
(
o
.
ropeExtrapolation
),
rope
.
WithAttentionFactor
(
attnFactor
),
rope
.
WithBetaFast
(
o
.
ropeBetaFast
),
rope
.
WithBetaFast
(
o
.
ropeBetaFast
),
rope
.
WithBetaSlow
(
o
.
ropeBetaSlow
),
rope
.
WithBetaSlow
(
o
.
ropeBetaSlow
),
)
)
...
...
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