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
[TF - Fix] Fix imports from tensorflow.python.keras with tf.__version__ >= 2.5.0 #3157
[TF - Fix] Fix imports from tensorflow.python.keras with tf.__version__ >= 2.5.0 #3157
Conversation
8c43ff9
to
d4585d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The only question I have is how this relates to horovod.keras
vs horovod.tensorflow.keras
. We created the latter because TF moved Keras into TF natively, but now they're moving it back to its own repo. Should users just use horovod.keras
going forward?
Unit Test Results 385 files ±0 385 suites ±0 5h 22m 0s ⏱️ + 8m 9s For more details on these failures, see this check. Results for commit 4660683. ± Comparison against base commit 9cd8f79. ♻️ This comment has been updated with latest results. |
IMHO if the "APIs" we depend on can exclusively use "import keras", then we should unify them going forward. Though code backward compat may not be straight forward. If we do this, let's do this in a subsequent PR. |
@tgaddair let me give a bit of clarification, there used to be 3 ways to import Keras:
Solution 3) is 100% deprecated and will be removed in TF 2.7 or 2.8. So knowing this, I think we should stop doing Does it sound fair to you ? |
d4585d9
to
4b4b747
Compare
I fixed my PR everywhere except for Spark stuff. This part of the code is very convoluted, with "normal Keras" and "TF Keras". Which essentially now are the same. Horovod now dynamically decides what
|
f3fdcad
to
b2b8d3c
Compare
I can take a look of Spark estimator stuff. |
After using this diff,
I cannot run |
Test in #3183:
|
b2b8d3c
to
af99210
Compare
Unit Test Results (with flaky tests) 393 files + 4 393 suites +4 5h 38m 48s ⏱️ + 8m 11s For more details on these failures, see this check. Results for commit 4660683. ± Comparison against base commit 9cd8f79. ♻️ This comment has been updated with latest results. |
It looks like the version switching point should be I saw |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What is the reason this did not make it into master? Is this still a desirable fix? |
I think TF |
Continue and test in #3403 |
Since Tensorflow 2.5, any import to
tensorflow.python.keras
is to be considered unstable / unsupported.As a matter of fact, if you check the wheel manifest, starting with 2.5.0, Tensorflow directly depends on Keras:
Due to the backward compatibility nature of HVD, we can't just remove the code. Hence, I am introducing conditional imports based on the value of
tf.__version__