Fixed Deepseek2 adding nil tensor error

This commit is contained in:
Grace 2025-10-03 14:20:06 -07:00 committed by GitHub
parent e4340667e3
commit 33801c1597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,7 +150,9 @@ func (moe *sparse) Moe(ctx ml.Context, hiddenStates, topKIndices, topKWeights ml
}
func (moe *sparse) topKIndices(ctx ml.Context, scores ml.Tensor, opts *Options) ml.Tensor {
if moe.ExpProbsBias != nil {
scores = scores.Add(ctx, moe.ExpProbsBias)
}
topKIndices := scores.TopK(ctx, opts.numExpertsUsed)
return topKIndices
}