Skip to content

Forward ignore_decode_attribute in nested require_decoding calls - #8892

Open
udsy19 wants to merge 1 commit into
huggingface:mainfrom
udsy19:fix/require-decoding-ignore-decode-attribute
Open

udsy19 wants to merge 1 commit into
huggingface:mainfrom
udsy19:fix/require-decoding-ignore-decode-attribute

Conversation

@udsy19

@udsy19 udsy19 commented Oct 24, 2026

Copy link
Copy Markdown

What

require_decoding(feature, ignore_decode_attribute=...) drops ignore_decode_attribute when it recurses: the dict, list/tuple, LargeList and List branches call require_decoding(f) without forwarding the flag. Only a top-level feature honours it.

ignore_decode_attribute=True is passed by Dataset.push_to_hub, Dataset._estimate_nbytes (arrow_dataset.py) and IterableDataset.push_to_hub (iterable_dataset.py) to decide which columns' external files get embedded into the shards. For a nested decode=False feature — e.g. {"img": Image(decode=False)} or List(Image(decode=False)) — the flag was lost, so require_decoding(..., ignore_decode_attribute=True) returned False. Those columns would be pushed as file paths instead of embedded bytes, and their size under-estimated for sharding.

(Same forwarding bug as the already-merged #8349, which fixed require_storage_embed.)

Fix

Forward ignore_decode_attribute in the four recursive calls.

Tests

Adds test_require_decoding_ignore_decode_attribute_nested to tests/features/test_features.py, parametrized over a bare Audio(decode=False), a dict, a list, LargeList and List; each asserts require_decoding(f, ignore_decode_attribute=True) is True and require_decoding(f) is False. Verified fail-on-revert: on upstream the four nested cases fail; with the fix all 7 pass.

require_decoding dropped ignore_decode_attribute when recursing into
dicts, lists and List/LargeList, so nested decode=False features were
not detected as decodable (e.g. push_to_hub embed_external_files).

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
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.

1 participant