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

add option to set a constant random seed for deterministic results #196

Closed
eyaler opened this issue Mar 19, 2017 · 1 comment
Closed

add option to set a constant random seed for deterministic results #196

eyaler opened this issue Mar 19, 2017 · 1 comment
Labels
enhancement feature or enhancement

Comments

@eyaler
Copy link
Contributor

eyaler commented Mar 19, 2017

seems that the random seed always involves the system clock and i could not find a way to set a constant seed to get deterministic results for debugging. (also, please let me know if i am opening too many issues. maybe we should have a mailing list or forum?)

@ppwwyyxx
Copy link
Collaborator

ppwwyyxx commented Mar 19, 2017

Just added a function utils.fix_rng_seed in 546af8b.
You'll also need to avoid any kind of parallelism:

  1. set 1 inter/intra op parallelism thread in session config
  2. don't use any kind of prefetch
  3. set use_locking=True in the optimizer

And set seed at the beginning of your program by both fix_rng_seed and tf.set_random_seed.

And this still cannot guarantee deterministic results, they just make things more deterministic. After doing the above things I see very tiny differences when training mnist for a couple of epochs.
Because a lot of common ops (both on GPU and CPU) are non-deterministic. tensorflow/tensorflow#3103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants