Forward iter_arrow, is_typed and features from RepeatExamplesIterable - #8395
Open
ebarkhordar wants to merge 1 commit into
Open
Forward iter_arrow, is_typed and features from RepeatExamplesIterable#8395ebarkhordar wants to merge 1 commit into
ebarkhordar wants to merge 1 commit into
Conversation
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.
RepeatExamplesIterablenever forwardediter_arrow,is_typedorfeaturesto the iterable it wraps, so.repeat()stranded an Arrow-capable child behind a non-Arrow parent: iteration fell back to the per-example path and the dtypes were re-inferred from Python objects.This copies the three-property block and the
_iter_arrowloop fromSkipExamplesIterableandTakeExamplesIterable, which sit either side of it._iter_arrowmirrors__iter__exactly, including the per-pass reset of the child state dict, sostate_dict()/load_state_dict()behaves the same on both paths.Verification
On
mainatb7cb10b, Python 3.12, pyarrow 25.0.0, numpy 2.5.1:test_iterable_dataset_repeat_keeps_numpy_dtypesreportsint64/float64/int64before against a declaredint32/float32/uint8;test_repeat_examples_iterable_arrowassertsiter_arrow is not Noneand runs bothassert_load_state_dict_resumes_iterationandassert_load_state_dict_resumes_arrow_iteration.tests/test_iterable_dataset.pygoes from 441 passed to 445 passed, with the same 4 pre-existingtest_interleave_dataset_with_shardingfailures on both sides (a missing optional dependency in my environment, unrelated to this change)..take(100000)at 0.465s.list(ds.repeat(2))is unchanged.ruff format --checkandruff checkare clean on both files.What I did not check: the torch formatter, and non-scalar feature types such as
Image. The dtype claim above is scoped to scalarValuecolumns undernumpyformat.Fixes #8394