Skip to content

Conversation

@hertschuh
Copy link
Collaborator

Arbitrary functions and classes are not allowed.

  • Made Operation extend KerasSaveable, this required moving imports to avoid circular imports
  • Layer no longer need to extend KerasSaveable directly
  • Made feature space Cross and Feature extend KerasSaveable
  • Also dissallow public function enable_unsafe_deserialization

@hertschuh hertschuh marked this pull request as draft June 27, 2025 18:17
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2025

Codecov Report

❌ Patch coverage is 76.47059% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.72%. Comparing base (df58ec9) to head (c69516b).
⚠️ Report is 132 commits behind head on master.

Files with missing lines Patch % Lines
keras/src/saving/saving_lib.py 73.68% 3 Missing and 2 partials ⚠️
keras/src/saving/serialization_lib.py 33.33% 1 Missing and 1 partial ⚠️
keras/src/ops/operation.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21429      +/-   ##
==========================================
- Coverage   82.72%   82.72%   -0.01%     
==========================================
  Files         565      565              
  Lines       55222    55245      +23     
  Branches     8609     8612       +3     
==========================================
+ Hits        45683    45700      +17     
- Misses       7428     7433       +5     
- Partials     2111     2112       +1     
Flag Coverage Δ
keras 82.53% <76.47%> (-0.01%) ⬇️
keras-jax 63.34% <76.47%> (+<0.01%) ⬆️
keras-numpy 58.51% <50.00%> (-0.02%) ⬇️
keras-openvino 33.78% <29.41%> (-0.02%) ⬇️
keras-tensorflow 63.75% <76.47%> (+<0.01%) ⬆️
keras-torch 63.35% <50.00%> (-0.02%) ⬇️

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.

Arbitrary functions and classes are not allowed.

- Made `Operation` extend `KerasSaveable`, this required moving imports to avoid circular imports
- `Layer` no longer need to extend `KerasSaveable` directly
- Made feature space `Cross` and `Feature` extend `KerasSaveable`
- Also dissallow public function `enable_unsafe_deserialization`
@hertschuh hertschuh force-pushed the serialization_fix branch from fdf490e to c69516b Compare June 27, 2025 18:43
@hertschuh hertschuh marked this pull request as ready for review June 27, 2025 20:19
Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jun 29, 2025
@fchollet fchollet merged commit 713172a into keras-team:master Jun 29, 2025
10 checks passed
Mohamed-Ashraf273 pushed a commit to Mohamed-Ashraf273/keras that referenced this pull request Jul 8, 2025
…eras-team#21429)

Arbitrary functions and classes are not allowed.

- Made `Operation` extend `KerasSaveable`, this required moving imports to avoid circular imports
- `Layer` no longer need to extend `KerasSaveable` directly
- Made feature space `Cross` and `Feature` extend `KerasSaveable`
- Also dissallow public function `enable_unsafe_deserialization`
kharshith-k pushed a commit to kharshith-k/keras that referenced this pull request Jul 23, 2025
…eras-team#21429)

Arbitrary functions and classes are not allowed.

- Made `Operation` extend `KerasSaveable`, this required moving imports to avoid circular imports
- `Layer` no longer need to extend `KerasSaveable` directly
- Made feature space `Cross` and `Feature` extend `KerasSaveable`
- Also dissallow public function `enable_unsafe_deserialization`
@hertschuh hertschuh deleted the serialization_fix branch July 23, 2025 19:10
hertschuh added a commit that referenced this pull request Nov 13, 2025
* added requirements-tensorflow-tpu.txt and tpu configuration in .kokoro

* updated .kokoro/github/ubuntu/tpu/build.sh with jax and torch backend configs

* Changed the tpu CI config files path to .github from .kokoro

* Added new job in .github/workflows/actions.yml to run TPU tests

* fixed runs-on option in acvtions.yml for tpu_build job to run on self hosted TPU based runner

* Added another runner in the actions TPU job

* Update continuous.cfg

updated build file path

* Update presubmit.cfg

updated build file path

* Update actions.yml

Updated tpu_build job of actions.yml with specific runner label

* Developed Dockerfile for TPU build job in actions.yml

* Update actions.yml

Added container section

* Included few more runners in tpu_build job

* Using linux-x86-ct6e-44-1tpu

* Modified requirement-commmon.txt and updated requirements-tensorflow-tpu.txt

* Added Dtypes_TPU_tests.py and requirements-jax-tpu.txt

* Progress bar now handles `steps_per_execution`. (#21422)

Progress bar would always report the starting batch + 1 at the end of the batch. Now it takes into account `steps_per_execution` for the last batch reported.

Fixes #20861

* Fix symbolic call of `logsumexp` with int axis. (#21428)

Using `keras.ops.math.logsumexp` with an int for `axis` in a functional model would throw an error.

* Only allow deserialization of `KerasSaveable`s by module and name. (#21429)

Arbitrary functions and classes are not allowed.

- Made `Operation` extend `KerasSaveable`, this required moving imports to avoid circular imports
- `Layer` no longer need to extend `KerasSaveable` directly
- Made feature space `Cross` and `Feature` extend `KerasSaveable`
- Also dissallow public function `enable_unsafe_deserialization`

* commented tensorflow deps

* Added log of dtypes_test_tpu.py and the test script for the same

* modified dtypes_test_tpu.py as per pre-commit standards

* Added TPU initiaization and teardown functionalities in conftest.py, developed dtypes_new_test.py to use requires_tpu marker

* Added dtypes_test_TPU.py and dtypes_new_test.py, modified conftest.py

* Added Dcokerfile and tests list command

* Updated Dockerfile

* Restored Dockerfile to previous changes

* updated actions.yml file to install and configure docker engine on self hosted runner, build the image and check TPU support on jax backend

* updated actions.yml file to include container option

* updated actions.yml file to include container option without volume binding

* updated actions.yml file to change TPU

* Updated container path in build-and-test-on-tpu job

* seperated TPU workflow from actions.yml

* updated trigger condition for TPU tests workflow

* updated container usage configuration for TPU tests workflow

* updated env vars for TPU tests workflow

* updated env vars parsing syntax in TPU tests workflow

* updated env vars syntax in TPU tests workflow

* updated env vars syntax in TPU tests workflow

* updated env vars syntax in TPU tests workflow

* updated env vars syntax in TPU tests workflow

* updated image name in TPU tests workflow

* updated image name with generic ubuntu image

* updated tpu-tests to use ghcr

* updated tpu-tests to store built image as local tar

* updated image name from ubuntu:22.04 to docker:24.0-cli in tpu tests workflow

* updated image name from docker:24.0-cli to ubuntu:22.04  in tpu tests workflow and added a step to install docker client

* added volume mount from host in load-and-test-job

* Reverted tpu-tests.yml to version using ghcr.io for image storage

* Removed custom dtypes_test files for TPU testing and restored original actions.yml

* Updated tpu-tests.yml to pull image from GCP artifact registry

* Resolved conflicts in actions.yml

* Added a workflow to check service accounts associated with self hosted runners

* Made find_sa.yml specific to linux-x86-ct6e-44-1tpu

* Added container tag to find_sa.yml

* Checking SA for linux-x86-ct5lp-112-4tpu

* Checking SA for linux-x86-ct6e-44-1tpu-nxgm7-runner-vb87c

* Using SA for auth in tpu-tests

* Updated SA with container tag for auth in tpu-tests

* Added docker socket mount test

* Updated tpu-tests to just pull and test the image from artifact registry after attaching service accounts as IAM policies

* Added pytest command to the workflow

* added grain installation command

* Pruned unwanted files

* included grain in requirements.txt

* Updated tpu-tests.yml to use python image and explicitly install specific backend deps

* Renamed tpu-tests to tpu-tests-jax and logging TPU device kind

* Added a step to check gcloud installation

* Running pytest on generic tpu workflow

* Made changes as per suggestions in PR

* Fixed error in action file

* Added a job in tpu workflow to persist failed tests list

* using requirements-jax-tpu.txt

* Reverted the tpu-tests-jax.yml

* Removed a command line option in tpu workflow file

* Removed uninstall step from tpu workflow job

* reverted tensorflow version in requirements file

* Updated the tpu workflow to skip failing tests

* Clean up TPU tests workflow by removing comment

Removed commented out pip uninstall command from workflow.

* Changed the failed tests file path and updated the same in conftest.py

* Updated the failed test file path

* Updated the workflow and job names for TPU

* Added TPU job in actions.yml

* Added TPU config print line

* Added condition to TPU test job so that it gets triggered only after the PR review is approved

* Added TPU specific tests in seperate workflow with PR approval condition

* Removed pull_request condition for workflow execution and renamed the workflow

---------

Co-authored-by: hertschuh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:force-run ready to pull Ready to be merged into the codebase size:M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants