-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix perplexity and bring text modality to SOTA possible #90
Open
bhavul
wants to merge
13
commits into
master
Choose a base branch
from
text_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When we added `padding='longest'` to the tokenization, it caused empty strings to be padded to the same length as the longest sample. That meant that `numel()` was never going to be 0. This commit moves the empty string check to the part of the code that loads the dataset into memory. Because of the way we're sampling indices in `sample_batch`...: ``` sampled_indices = torch.randperm(len(dataset_split))[:batch_size] samples = dataset_split.select(sampled_indices) tokenized_outputs = self.text_tokenizer(samples['text'], truncation=True, padding="longest", max_length=self.context_length, return_tensors='pt') ``` ... we were ending up with batches of varying sizes, depending on how many empty text strings we sampled. We always sample 64 indices, for example, but sometimes we might get 20 of them that are empty strings. Other times we might get 10 of them that are empty strings. Therefore our batch size would vary on each sample. By filtering when we load the dataset into memeory, we guarantee every batch size to be the same.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the perplexity bug that has been haunting NEKO for months! :)