Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multi-process dataloader with same random seeds #1078

Merged
merged 2 commits into from Jun 23, 2021
Merged

fix multi-process dataloader with same random seeds #1078

merged 2 commits into from Jun 23, 2021

Conversation

parap1uie-s
Copy link
Contributor

following

https://tanelp.github.io/posts/a-bug-that-plagues-thousands-of-open-source-ml-projects/

@nepeplwu nepeplwu merged commit fd72e90 into PaddlePaddle:develop Jun 23, 2021


def worker_init_fn(worker_id):
np.random.seed(np.random.get_state()[1][0] + worker_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好,这里有考虑epoch层面的seed吗?就像https://tanelp.github.io/posts/a-bug-that-plagues-thousands-of-open-source-ml-projects/ 中说的np.random.seed(initial_seed + epoch)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

啊,漏掉了,我补一下

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.

None yet

3 participants