datasets icon indicating copy to clipboard operation
datasets copied to clipboard

fix: skip filename-based split detection for media files in get_data_…

Open Work4itnow opened this issue 5 months ago • 0 comments

Fixes #7201

Problem

When a user has an image file named train.png in a flat folder, the library mistakenly treats it as a split name instead of an image, resulting in only that one file being loaded.

Fix

Modified _get_data_files_patterns in data_files.py to skip filename-based split detection when all matched files are media files (images, audio, video). This causes it to fall through to DEFAULT_PATTERNS_ALL which correctly loads all files.

Test

Added test_data_files_with_image_named_after_split to verify that all images are loaded when one is named after a split.

Work4itnow avatar Jun 11 '26 04:06 Work4itnow