gemma: fix rope scaling for qat models (#12348)

* gemma: fix rope scaling for qat models

* gofumpt yourself
This commit is contained in:
Patrick Devine
2025-09-19 15:04:40 -07:00
committed by GitHub
parent 9f3a37fd36
commit dba39b2eee
2 changed files with 6 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ func (sa *SelfAttention) Forward(ctx ml.Context, hiddenState, positionIDs ml.Ten
}
func (m *Model) Shift(ctx ml.Context, layer int, key, shift ml.Tensor) (ml.Tensor, error) {
return fast.RoPE(ctx, key, shift, m.Options.attnKeyLen, m.Options.ropeBase, m.Options.ropeScale, rope.WithTypeNeoX()), nil
return fast.RoPE(ctx, key, shift, m.Options.attnKeyLen, m.Options.ropeBase, 1/m.Options.ropeScale, rope.WithTypeNeoX()), nil
}
type MLP struct {