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

Add numpy trainer #633

Merged
merged 4 commits into from
Jul 28, 2023
Merged

Conversation

james77777778
Copy link
Contributor

related to keras-team/keras#18442

This PR mainly implements the numpy trainer with references to torch and jax.

Two tests have been added to improve the test coverage of the numpy trainer:

  • test_steps_per_execution_steps_count_without_training
  • test_on_batch_methods_without_training
Name                                   Stmts   Miss  Cover
----------------------------------------------------------
keras_core/backend/numpy/trainer.py      142      5    96%

Additionally, there is a bug that some steps_per_execution are missing in TFEpochIterator declaration in keras_core/backend/tensorflow/trainer.py. It has been catched by new tests and fixed by this PR.

Copy link
Contributor

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

Excellent work! 👍

return_dict=False,
**kwargs,
):
# TODO: respect compiled trainable state
Copy link
Contributor

Choose a reason for hiding this comment

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

For reference, this is something that tf.keras always does (use the trainable values of layers as they existed at the time compile() was called), which may not always be verified in some cases in Keras Core.

@fchollet fchollet merged commit 4536713 into keras-team:main Jul 28, 2023
@james77777778 james77777778 deleted the add-numpy-trainer branch July 28, 2023 06:04
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.

2 participants