dmlc / gluon-nlp

NLP made easy

Home Page:https://nlp.gluon.ai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Bug of top-p sampling

sxjscience opened this issue · comments

Description

The top-p sampling here is not correct.

probs = mx.np.where(
probs > self._sampling_topp,
probs,
mx.np.zeros_like(probs)
)
We should sort the probabilities in descending order and then do a cumsum of the probabilities. After that, we set the threshold based on the cumsum values.

@hymzoque