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: Keras reproducibility guide in the call #671

Merged
merged 1 commit into from
Oct 22, 2021
Merged

Add: Keras reproducibility guide in the call #671

merged 1 commit into from
Oct 22, 2021

Conversation

sayakpaul
Copy link
Contributor

@sayakpaul sayakpaul commented Oct 19, 2021

@fchollet I have some preliminary work done in this: https://bit.ly/34V5ZNz. I wanted to extend it and include a call for contribution for this particular guide.

I have some pointers in mind:

  • Fixing seeds
  • Ensuring development infrastructure unification
  • tf-determinism for using deterministic CUDA kernels to trade away performance

With these, it's possible to attain at least some amount of reproducibility. But I am of course open to any suggestions you may have. I think it's time we had a guide on this topic.

@google-cla google-cla bot added the cla: yes label Oct 19, 2021
Copy link
Contributor

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Great idea, this would be a good guide or perhaps a walkthrough for the keras-recipes section!

Related to this, we have been making changes and simplifications to determinism and have started adopting stateless RNGs everywhere. This means that all random layers/etc will own a seed variable and will only run ops that are fully-seeded (constant given the seed value). It makes randomness much easier to understand and control.

There are a couple new APIs we should bring up:

  • A Keras API for seeding everything, keras.utils.set_random_seed(seed): a one-stop util for making everything seeded: numpy, tf, keras
  • A TF API for enabling fully-deterministic computation at the cost of a performance degradation, tf.config.experimental.enable_op_determinism()

IMO this is something that we should publish around the time of the TF 2.8 release.

@fchollet fchollet merged commit d216653 into keras-team:master Oct 22, 2021
@sayakpaul
Copy link
Contributor Author

Thank you @fchollet.

A TF API for enabling fully-deterministic computation at the cost of a performance degradation, tf.config.experimental.enable_op_determinism()

Sounds really good. We might want to even include a friendly warning message on the performance degradation part.

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

Successfully merging this pull request may close these issues.

2 participants