Method GetTokenCandidateByRank
- Namespace
- LMKit.TextGeneration.Events
- Assembly
- LM-Kit.NET.dll
GetTokenCandidateByRank(int)
Retrieves the identifier of a token based on its rank in terms of likelihood of occurrence, prior to the application of any sampling methods.
public int GetTokenCandidateByRank(int rankIndex)
Parameters
rankIndex
intThe rank position of the token for which the identifier is sought.
This must be an integer within the inclusive range of 0 and the upper limit of (Model.VocabCount - 1).
Returns
- int
The identifier of the token at the specified rank.
Remarks
The appearance probability may change subsequently after the application of repetition penalties and the execution of the sampling process.
Exceptions
- ArgumentOutOfRangeException
Thrown when the provided rankIndex is outside the valid range (i.e., less than 0 or greater than or equal to the total number of tokens in the vocabulary).
This ensures that the method call adheres to the constraints of the model's vocabulary size.