IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

topp_minp_sampling_kernel

def topp_minp_sampling_kernel[dtype: DType, out_idx_type: DType, is_top_p: Bool](p_thresholds_: UnsafePointer[Scalar[dtype], MutUntrackedOrigin], sorted_probs_: UnsafePointer[Scalar[dtype], MutUntrackedOrigin], sorted_ids_: UnsafePointer[Scalar[out_idx_type], MutUntrackedOrigin], out_token_ids: UnsafePointer[Scalar[out_idx_type], MutUntrackedOrigin], skip_sort: UnsafePointer[Scalar[DType.bool], MutUntrackedOrigin], vocab_size: Int)

Top P-Min P sampling kernel.

Parameters:

  • โ€‹dtype (DType): DType - scalar values dtype.
  • โ€‹out_idx_type (DType): DType - output index type.
  • โ€‹is_top_p (Bool): Bool - Whether to use Top-P (True) or Min-P (False) sampling.