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

changes to MappedExamplesIterable to resolve #7345 #7353

Merged
merged 7 commits into from
Jan 7, 2025

Conversation

vttrifonov
Copy link
Contributor

@vttrifonov vttrifonov commented Jan 4, 2025

modified MappedExamplesIterable and test_iterable_dataset.py::test_mapped_examples_iterable_with_indices

fix #7345

@lhoestq

@vttrifonov vttrifonov changed the title changes to MappedExamplesIterable to resolve #7345 [WIP] changes to MappedExamplesIterable to resolve #7345 Jan 4, 2025
@vttrifonov
Copy link
Contributor Author

vttrifonov commented Jan 4, 2025

I noticed that Dataset.map has a more complex output depending on remove_columns. In particular this line removes columns from output if the input is being modified in place (i.e. input_columns = None). I tried to mimic this behaviour in MappedExamplesIterable by checking if the input and output point to the same dictionary object.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

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

looks good to me !

can you run make style to fix code formatting for the CI ?
edit: I also took the opportunity to fix an old bug at #7358

src/datasets/iterable_dataset.py Outdated Show resolved Hide resolved
src/datasets/iterable_dataset.py Outdated Show resolved Hide resolved
@vttrifonov vttrifonov changed the title [WIP] changes to MappedExamplesIterable to resolve #7345 changes to MappedExamplesIterable to resolve #7345 Jan 7, 2025
Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

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

perfect !

@lhoestq lhoestq merged commit 9e88687 into huggingface:main Jan 7, 2025
14 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.

Different behaviour of IterableDataset.map vs Dataset.map with remove_columns
3 participants