-
Notifications
You must be signed in to change notification settings - Fork 451
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
[To keep] -- [build] tf upgrade by keeping keras v2 #1542
[To keep] -- [build] tf upgrade by keeping keras v2 #1542
Conversation
0067628
to
cc6db23
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.
Why did you set TF_USE_LEGACY_KERAS=1
everywhere as it is the default behavior of your PR ?
The behavior of this env variable is super strange: By installing TF>= 2.16 it installs automatically keras>=3.0.0 so tf.keras is additonal installed (to keep keras v2 backwards compatibility with tf >= 2.16) I'm not sure why it works for everything ..without the latency scripts there it jumps all the time to keras 3 (also on the CI job) without setting |
cc6db23
to
50c35ca
Compare
@odulcy-mindee Now it works
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1542 +/- ##
==========================================
+ Coverage 96.39% 96.46% +0.07%
==========================================
Files 164 164
Lines 7823 7869 +46
==========================================
+ Hits 7541 7591 +50
+ Misses 282 278 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Why no more tf.function
?
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.
Before it was disabled globally so no tf.function has had any effect
the functions where the tf.function annotation is removed makes use of numpy which is not compatible with the compilation (which is triggered for the tf.function annotated functions)
On hold |
0cab9d0
to
f0d6be8
Compare
7b714d8
to
784fcb7
Compare
@odulcy-mindee Our fallback if we don't have a working version with keras v3 end of the year :) |
@odulcy-mindee After digging (again) a bit deeper into the keras v3 upgrade:
So i would suggest to stick with the solution of the PR ftm. wdyt ? |
) | ||
|
||
|
||
def ensure_keras_v2() -> None: # pragma: no cover |
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.
@odulcy-mindee
The breaking point here is that doctr needs to be imported before tensorflow:
two options:
- we keep the ensure_keras_v2 to make it explicit
- we import doctr (in the training / eval scripts) first and ignore ruff's (isort)
What would you prefer ?
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.
Keep ensure_keras_v2
function, because option 2 will be a hell to maintain in my opinion
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.
Yes i agree :D
@odulcy-mindee btw could you check your slack ? ^^
If you don't have any solution, let's keep the PR likes that |
1.It's a bug but i need to open a ticket for this (not done yet) |
@odulcy-mindee |
We will move to keras v3 at any time but it's really hard and i spent already a lot (to much 😅) time on it |
Closes: #1673 |
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.
Ok, let's keep it like that, thank you !
This PR:
@odulcy-mindee This would work if we want to upgrade tf by keeping keras at version 2 without the need to change the current model saving/loading / refactoring everything (would be only a temp fix)
I'm super unhappy with this PR but i don't see an alternative atm 😓