Skip to content

update Python version requirement and TensorFlow dependency in pyproj…#72

Open
bnb32 wants to merge 22 commits intomainfrom
bnb/tf
Open

update Python version requirement and TensorFlow dependency in pyproj…#72
bnb32 wants to merge 22 commits intomainfrom
bnb/tf

Conversation

@bnb32
Copy link
Copy Markdown
Collaborator

@bnb32 bnb32 commented Apr 19, 2026

Migrating to keras 3, tensorflow < 2.21, and python < 3.14

  • Primarily motivated by flash attention being available for 2.16+
  • Also, since Keras 3 splits from tensorflow and becomes a multi-backend library this could be a first step towards removing dep on tensorflow (tf.keras -> keras) and being able to use pytorch or JAX as a backend.
  • Lots of back and forth on saving / loading models but ultimately we can keep that logic as long as we register custom layers with keras to be serialized.
  • Explicit building of child layers also now required for correct deserialization.

Lots of auto-formatting changes but real net changes are fairly minimal, almost entirely in custom_layers.py, and consist of the following:

  • register custom layers
  • add get_config methods
  • add build methods and child build calls.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 19, 2026

Codecov Report

❌ Patch coverage is 79.59184% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.91%. Comparing base (54e9753) to head (525ceb9).

Files with missing lines Patch % Lines
phygnn/layers/custom_layers.py 65.24% 49 Missing ⚠️
phygnn/layers/handlers.py 54.54% 5 Missing ⚠️
phygnn/base.py 85.71% 3 Missing ⚠️
phygnn/phygnn.py 93.75% 2 Missing ⚠️
phygnn/model_interfaces/phygnn_model.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
- Coverage   88.36%   87.91%   -0.45%     
==========================================
  Files          24       24              
  Lines        3583     3559      -24     
==========================================
- Hits         3166     3129      -37     
- Misses        417      430      +13     
Flag Coverage Δ
unittests 87.91% <79.59%> (-0.45%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates project runtime requirements (Python/TensorFlow) and adjusts TensorFlow/Keras integration to remain compatible with newer TF/Keras behaviors (notably model serialization and layer/optimizer handling).

Changes:

  • Bump supported Python baseline to 3.9+ and update TensorFlow pin to >=2.16.1,<2.17 (plus CI matrix updates).
  • Update model save/load behavior to use a model.keras artifact and attempt custom-layer deserialization support.
  • Keras-compatibility tweaks in core training/inference (optimizer deserialization, gradient tape usage, InputLayer handling) and removal of the FNO layer/tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pyproject.toml Raises Python requirement and updates TensorFlow dependency pins.
.github/workflows/pull_request_tests_tf_latest.yml Updates PR test matrix to drop 3.8 and add 3.12 coverage.
.github/workflows/linter.yml Removes super-linter job, leaving Ruff as the lint gate.
phygnn/model_interfaces/tf_model.py Saves to model.keras and loads with discovered custom_objects.
phygnn/layers/custom_layers.py Adjusts several custom layer constructors for Keras deserialization; removes FNO implementation.
phygnn/base.py Updates prediction path to avoid calling Keras 3 InputLayer directly; formatting/logging changes.
phygnn/phygnn.py Uses optimizers.deserialize for optimizer config; removes explicit tape variable watching.
tests/test_layers.py Removes FNO tests; updates a nested hidden-layer config from Conv2D to Conv3D.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phygnn/model_interfaces/tf_model.py Outdated
Comment thread phygnn/model_interfaces/tf_model.py Outdated
Comment thread phygnn/layers/custom_layers.py
Comment thread phygnn/layers/custom_layers.py
Comment thread phygnn/layers/custom_layers.py Outdated
Comment thread pyproject.toml Outdated
bnb32 and others added 2 commits April 19, 2026 12:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phygnn/layers/custom_layers.py
Comment thread phygnn/base.py Outdated
Comment thread phygnn/model_interfaces/tf_model.py
Comment thread phygnn/model_interfaces/tf_model.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phygnn/base.py Outdated
Comment thread phygnn/model_interfaces/tf_model.py
Comment thread phygnn/layers/custom_layers.py
bnb32 and others added 2 commits April 19, 2026 20:28
…ort, add input shape handling, and improve skip connection functionality in tests
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phygnn/base.py Outdated
Comment thread tests/test_phygnn_interface.py
Comment thread phygnn/base.py Outdated
@bnb32 bnb32 requested a review from grantbuster April 22, 2026 16:41
@bnb32
Copy link
Copy Markdown
Collaborator Author

bnb32 commented Apr 24, 2026

@grantbuster There's not a ton to review here. Main "reviewable" is whether any breaking changes from keras 3 migration are worth caring about. I'll interpret emoji reactions and / or silence as approval :)

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 this pull request may close these issues.

3 participants