Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making perplexity calculations consistent across sample length #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcleish7
Copy link

When calculating perplexity, on lines 110 and 115 the code currently divides by len(token_probs) which is twice the length of token_probs[mid_index:] as mid_index = len(token_probs) // 2 but then on line 120, for the whole sequence, the code still divides by len(token_probs).
This means the is a slight inconsistency in the perplexity calculation.

I have corrected this by using a single function cases, also removing the repeated code.

@CLAassistant
Copy link

CLAassistant commented Jul 13, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants