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

[To keep] -- [build] tf upgrade by keeping keras v2 #1542

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

felixdittrich92
Copy link
Contributor

@felixdittrich92 felixdittrich92 commented Apr 10, 2024

This PR:

  • upgrade TF by staying at keras v2

@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 😓

@felixdittrich92 felixdittrich92 added topic: build Related to dependencies and build topic: ci Related to CI framework: tensorflow Related to TensorFlow backend labels Apr 15, 2024
Copy link
Collaborator

@odulcy-mindee odulcy-mindee left a 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 ?

pyproject.toml Outdated Show resolved Hide resolved
@felixdittrich92
Copy link
Contributor Author

felixdittrich92 commented Apr 18, 2024

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 TF_USE_LEGACY_KERAS=1 in front of your script - which leads to errors

@felixdittrich92 felixdittrich92 added this to the 0.9.0 milestone Apr 24, 2024
@felixdittrich92 felixdittrich92 self-assigned this Apr 24, 2024
@felixdittrich92
Copy link
Contributor Author

@odulcy-mindee Now it works

  • Added as function instead of os.environ .. in every script which makes it easier to remove later on if we have a solution with keras v3

@felixdittrich92 felixdittrich92 changed the title [DRAFT] tf upgrade by keeping keras v2 [build] tf upgrade by keeping keras v2 Apr 24, 2024
@felixdittrich92 felixdittrich92 marked this pull request as ready for review April 24, 2024 09:55
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.46%. Comparing base (dccc26b) to head (9940348).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
doctr/file_utils.py 71.42% 2 Missing ⚠️
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     
Flag Coverage Δ
unittests 96.46% <94.28%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

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 ?

Copy link
Contributor

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)

@felixdittrich92 felixdittrich92 marked this pull request as draft April 26, 2024 16:18
@felixdittrich92
Copy link
Contributor Author

On hold

@felixdittrich92 felixdittrich92 changed the title [build] tf upgrade by keeping keras v2 [To keep] -- [build] tf upgrade by keeping keras v2 May 15, 2024
@felixdittrich92 felixdittrich92 modified the milestones: 0.9.0, 1.0.0, 0.10.0 Jun 6, 2024
@felixdittrich92
Copy link
Contributor Author

@odulcy-mindee Our fallback if we don't have a working version with keras v3 end of the year :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework: tensorflow Related to TensorFlow backend topic: build Related to dependencies and build topic: ci Related to CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants