Conversation
ec5b555 to
b1d64ef
Compare
f9c5f49 to
b35efc0
Compare
Contributor
|
TBD if we need to do this or not @tyoc213 we should replace this: def __iter__(self) -> Iterable[dict[str, NDArray]]:
buffer = []
for sample in self.hf_dataset:
encoded = self.tokenizer(
sample['text'],
truncation=False,
padding=False,
)
iids = encoded['input_ids']
buffer = buffer + self.bos_tokens + iids + self.eos_tokens
while len(buffer) >= self.max_length:
concat_sample = buffer[:self.max_length]
buffer = buffer[self.max_length:] if self.should_wrap else []
yield {
# convert to ndarray to store in MDS format
'tokens': np.asarray(concat_sample, dtype=np.int32),
}to something like this: def __iter__(self) -> Iterable[dict[str, NDArray]]:
for sample in self.hf_dataset:
encoded = self.tokenizer(
sample['text'],
truncation=False,
padding=False,
)
iids = self.bos_tokens + encoded['input_ids'] + self.eos_tokens
yield {
# convert to ndarray to store in MDS format
'tokens': np.asarray(iids[:self.max_length], dtype=np.int32),
} |
e2b930c to
8608125
Compare
8608125 to
cc16eb3
Compare
This file contains hidden or 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
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.
Rewrite of the work done in #43