Skip to main content
Log in

Mojo module

toppminp

Functions

  • merge: Merge two sorted subarrays into one sorted array.
  • merge_sort_recursive: Recursive merge sort implementation.
  • min_p_sampling: Naive CPU implementation of Min-P sampling for token selection. This function applies temperature scaling, softmax, a merge sort, and then samples tokens based on the calculated probability threshold (Min-P).
  • sort_buf_descending: Sort each batch separately in descending order using parallel merge sort.
  • top_p_sampling: Naive CPU implementation of Top-P sampling for token selection. This function applies temperature scaling, softmax, a merge sort, and then samples tokens based on the cumulative probability mass (Top-P).

Was this page helpful?