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

update for tf2.4 #908

Merged
merged 8 commits into from
Dec 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions efficientdet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,11 @@ def build_model_with_precision(pp, mm, ii, *args, **kwargs):
inputs = tf.cast(ii, tf.bfloat16)
with tf.tpu.bfloat16_scope():
outputs = mm(inputs, *args, **kwargs)
set_precision_policy('float32')
Copy link
Collaborator Author

@fsx950223 fsx950223 Dec 24, 2020

Choose a reason for hiding this comment

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

After remove 2 lines, I could train estimator model with recompute_grad and mixed_precision.
Why set policy back to float32? Could I remove them? @mingxingtan

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please feel free to remove it. it is not necessary.

elif pp == 'mixed_float16':
set_precision_policy(pp)
inputs = tf.cast(ii, tf.float16)
with float16_scope():
outputs = mm(inputs, *args, **kwargs)
set_precision_policy('float32')
elif not pp or pp == 'float32':
outputs = mm(ii, *args, **kwargs)
else:
Expand Down