Skip to content

Restore dataloader state when iteration ends early - #4248

Open
WenJing95 wants to merge 1 commit into
huggingface:mainfrom
WenJing95:fix-validation-loader-lifecycle
Open

Restore dataloader state when iteration ends early#4248
WenJing95 wants to merge 1 commit into
huggingface:mainfrom
WenJing95:fix-validation-loader-lifecycle

Conversation

@WenJing95

Copy link
Copy Markdown

Closing a validation iterator early can leave it active in GradientState, causing the resumed training loop to skip or add optimizer updates during gradient accumulation. Run end() in finally for both DataLoaderShard and DataLoaderDispatcher so closing or failing iterators restore the active training loader.

Added regression coverage for update cadence and iterator cleanup; the dataloader, optimizer and scheduler tests pass on CPU (57 passed, 3 skipped).

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