Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Fixed Deepseek2 adding nil tensor error

Grace33801c1597ed
diff --git a/model/models/deepseek2/model.go b/model/models/deepseek2/model.go
index 7b88711ba..7e57f72dd 100644
--- a/model/models/deepseek2/model.go
+++ b/model/models/deepseek2/model.go
@@ -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 {
- scores = scores.Add(ctx, moe.ExpProbsBias)
+ if moe.ExpProbsBias != nil {
+ scores = scores.Add(ctx, moe.ExpProbsBias)
+ }
topKIndices := scores.TopK(ctx, opts.numExpertsUsed)
return topKIndices
}