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 for mixed precision training #121

Closed
dustinvtran opened this issue Dec 8, 2019 · 0 comments · Fixed by #122
Closed

Add option for mixed precision training #121

dustinvtran opened this issue Dec 8, 2019 · 0 comments · Fixed by #122

Comments

@dustinvtran
Copy link
Member

dustinvtran commented Dec 8, 2019

Deterministic and BatchEnsemble baselines cast data as bfloat16 by default with TPUs. Following the cloud TPU imagenet example, we need to set a policy if we want to maintain bfloat16 for the activations, etc.

  if _USE_BFLOAT16:
    policy = tf.keras.mixed_precision.experimental.Policy('mixed_bfloat16')
    tf.keras.mixed_precision.experimental.set_policy(policy)

It should be easy enough to set up a boolean flag to use bfloat16 with that policy or otherwise operate in float32.

edward-bot pushed a commit that referenced this issue Dec 8, 2019
Code was not actually using mixed precision. It's now settable via a flag. Fixes #121.

Results are comparable with and without. Speedup is insignificant however, so I'm leaving it off by default.

PiperOrigin-RevId: 284398786
edward-bot pushed a commit that referenced this issue Dec 8, 2019
Code was not actually using mixed precision. It's now settable via a flag. Fixes #121.

Results are comparable with and without. Speedup is insignificant however, so I'm leaving it off by default.

PiperOrigin-RevId: 284398786
edward-bot pushed a commit that referenced this issue Dec 10, 2019
Code was not actually using mixed precision. It's now settable via a flag. Fixes #121.

Results are comparable with and without. Speedup is insignificant however, so I'm leaving it off by default.

PiperOrigin-RevId: 284398786
edward-bot pushed a commit that referenced this issue Dec 10, 2019
Code was not actually using mixed precision. It's now settable via a flag. Fixes #121.

Results are comparable with and without. Speedup is insignificant however, so I'm leaving it off by default.

PiperOrigin-RevId: 284398786
edward-bot pushed a commit that referenced this issue Dec 10, 2019
Code was not actually using mixed precision. It's now settable via a flag. Fixes #121.

Results are comparable with and without. Speedup is insignificant however, so I'm leaving it off by default.

PiperOrigin-RevId: 284398786
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 a pull request may close this issue.

1 participant