Split the torch assertions out of test_dataset_to_iterable_dataset - #8531
Open
LeSingh1 wants to merge 1 commit into
Open
Split the torch assertions out of test_dataset_to_iterable_dataset#8531LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
Most of the test does not need torch: it covers to_iterable_dataset, the
num_shards argument and its ValueError. Only the last two assertions use
with_format("torch"), and without torch installed they fail the whole test.
Moving them into a @require_torch test keeps the rest running everywhere.
Decorating the existing test instead would have skipped the torch-free
coverage too.
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.
The problem
test_dataset_to_iterable_datasetfails when torch is not installed:torch is an optional dependency, so running the suite without it is a supported configuration. It is the only test in this file that touches torch without
@require_torch.The fix
Most of the test does not need torch. It covers
to_iterable_dataset(), thenum_shardsargument, the features round-trip, and theValueErrorfor too many shards. Only the final two assertions usewith_format("torch").So rather than decorate the existing test, which would have skipped that torch-free coverage as well, I moved the two torch assertions into their own
@require_torchtest. Everything else keeps running everywhere.Verification
Without torch,
tests/test_arrow_dataset.pygoes from 1 failed / 362 passed / 61 skipped to 0 failed / 363 passed / 62 skipped — the torch-free half now passes where the whole test used to fail, and the new torch half skips. With torch installed both run exactly as before.Companion to #8530, which is the same gap in
tests/test_iterable_dataset.py. That one is a whole-test skip because the test there needs torch throughout; this one needed splitting instead.