saved state

This commit is contained in:
ParthSareen
2025-01-30 15:17:42 -08:00
parent c56a8b7749
commit b973dedb4b
7 changed files with 130 additions and 45 deletions

View File

@@ -165,11 +165,12 @@ func (s weighed) Sample(logits []float64) ([]float64, error) {
if len(logitsCopy) == 0 {
return nil, errors.New("no valid tokens found")
}
logitsCopy, err := computeSoftmax(logitsCopy)
softmax, err := computeSoftmax(logitsCopy)
if err != nil {
return nil, err
}
w := sampleuv.NewWeighted(logitsCopy, nil)
w := sampleuv.NewWeighted(softmax, nil)
if v, ok := w.Take(); ok {
// returns the token ID
return []float64{float64(indices[v])}, nil