Add custom iterable dataloader support in Accelerator.prepare#3984
Open
t7r0n wants to merge 1 commit intohuggingface:mainfrom
Open
Add custom iterable dataloader support in Accelerator.prepare#3984t7r0n wants to merge 1 commit intohuggingface:mainfrom
t7r0n wants to merge 1 commit intohuggingface:mainfrom
Conversation
Author
|
Additional local validation run in a uv-managed virtual environment: pytest tests/test_data_loader.py tests/test_accelerator.py -k not setting_cpu_affinity. Result: 81 passed, 5 skipped, 1 deselected. The deselected CPU affinity test is hardware-specific on this machine (NVML CPU affinity not supported) and unrelated to this PR changes. |
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.
Summary\n- add
DataLoaderConfiguration.custom_classesso users can register iterable dataloader-like classes\n- add a lightweightCustomIterableDataLoaderwrapper that:\n - iterates the underlying object\n - optionally moves each batch to device\n - preserves accelerate dataloader state tracking for gradient synchronization\n- updateAccelerator.prepare/prepare_data_loaderflow to treat configured custom classes as dataloaders\n\n## Tests\n- addtest_prepare_data_loader_with_custom_iterable_loaderintests/test_data_loader.py\n- addtest_prepare_with_custom_iterable_dataloaderintests/test_accelerator.py\n\n## Local verification\n-python3 -m compileall src/accelerate/accelerator.py src/accelerate/data_loader.py src/accelerate/utils/dataclasses.py tests/test_data_loader.py tests/test_accelerator.py\n- direct runtime smoke check withPYTHONPATH=srcfor bothprepare_data_loaderandAccelerator.preparecustom iterable paths\n- full pytest run in this environment is blocked by missing test dependency:parameterized\n\nCloses #2975