Skip to content

Add Perplexity metric#10

Merged
jshin1394 merged 1 commit intogoogle:mainfrom
jeffcarp:perplexity
Feb 12, 2025
Merged

Add Perplexity metric#10
jshin1394 merged 1 commit intogoogle:mainfrom
jeffcarp:perplexity

Conversation

@jeffcarp
Copy link
Collaborator

No description provided.

@jshin1394
Copy link
Collaborator

Seems like there is an error with ERROR: Could not find a version that satisfies the requirement tensorflow==2.18.0 (from versions: none) ERROR: No matching distribution found for tensorflow==2.18.0

It is weird as I can see tensorflow 2.18.0 in their pypi page https://pypi.org/project/tensorflow/#history

Args:
predictions: A floating point 2D vector representing the prediction
generated from the model. The shape should be (batch_size, seq_len).
labels: True value. The shape should be (batch_size, seq_len).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean that this can be multi label? for instance, predictions may be [5 0 2] and the label is [1 0 1]?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, getting the probability of each element inside predictions in line 583 suggests that we have a single label scenario

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think this works for multi-label currently (it also converts the labels to one-hot on L586). How common are labels with >1 truth values in NLP eval?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then the shape of labels is (batch_size, ) then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline - will update predictions shape to add vocab_size

@jeffcarp jeffcarp force-pushed the perplexity branch 7 times, most recently from fcc5933 to f7c7534 Compare February 12, 2025 20:55
@jeffcarp
Copy link
Collaborator Author

Seems like there is an error with ERROR: Could not find a version that satisfies the requirement tensorflow==2.18.0 (from versions: none) ERROR: No matching distribution found for tensorflow==2.18.0

Specifying Python 3.12 (one major version behind the latest) fixed the problem.

@jshin1394 jshin1394 merged commit 9686e7c into google:main Feb 12, 2025
3 checks passed
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