Skip to content

Fix SimpleDataSet overriding the configured RNG seed - #218

Open
sopenlaz0 wants to merge 1 commit into
Topdu:mainfrom
sopenlaz0:fix/global-seed-dataloader
Open

Fix SimpleDataSet overriding the configured RNG seed#218
sopenlaz0 wants to merge 1 commit into
Topdu:mainfrom
sopenlaz0:fix/global-seed-dataloader

Conversation

@sopenlaz0

@sopenlaz0 sopenlaz0 commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Trainer seeds Python's process RNG from Global.seed, but SimpleDataSet
immediately calls random.seed(None) while sampling and shuffling whenever the
dataloader does not pass an explicit dataset seed. That replaces the configured
seed with system entropy, so otherwise identical runs can start with different
sample orders.

This change keeps the existing process RNG state when seed is None, while
preserving the previous explicit-seed behavior.

The fix is intentionally scoped to SimpleDataSet. It does not reinterpret
the existing seed argument globally, because other datasets use None and
epoch for different scheduling semantics.

Verification

  • Added a behavioral test using the real SimpleDataSet path:
    • same process seed -> identical sample order
    • different process seed -> different sample order
    • explicit dataset seed overrides process state
  • pytest -q tests/test_dataloader_seed.py: 1 passed
  • Structured autoreview: clean, no accepted/actionable findings

Base commit: 0d522801ec6dc1df852c6b6d4ed6a08f5127ed97.

@sopenlaz0
sopenlaz0 marked this pull request as ready for review August 7, 2026 04:34
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