Skip to content

apply_top_p_filtering function should remove indices with probabilities from small to big #18

Description

@yaojingguo

In function apply_top_p_filtering, there is the following code:

if len(sorted_indices_to_remove) > len(sorted_indices) - min_tokens_to_keep:
    sorted_indices_to_remove = sorted_indices_to_remove[
        :len(sorted_indices) - min_tokens_to_keep
    ]

It remove indices with probabilities from big to small. The correct way is removes from small to big:

if len(sorted_indices_to_remove) > len(sorted_indices) - min_tokens_to_keep:
    sorted_indices_to_remove = sorted_indices_to_remove[
        -(len(sorted_indices) - min_tokens_to_keep):
    ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions