Skip to content

Add an easy way to run a script for a few steps only #21217

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattdangerw
Copy link
Member

@mattdangerw mattdangerw commented Apr 28, 2025

I've wanted this tool for a while, figured I should just propose it. Often I need to test out a script or colab I did not write, and just want to run a few train steps without for every fit call without finding every call to fit in the script. This adds a debugging tool to do just that.

KERAS_MAX_EPOCHS=1 KERAS_MAX_STEPS_PER_EPOCH=5 python train.py

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 81.25000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 82.60%. Comparing base (81c5097) to head (be00d62).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
keras/api/_tf_keras/keras/config/__init__.py 0.00% 4 Missing ⚠️
keras/src/backend/config.py 77.77% 2 Missing and 2 partials ⚠️
keras/src/trainers/epoch_iterator.py 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21217      +/-   ##
==========================================
- Coverage   82.60%   82.60%   -0.01%     
==========================================
  Files         564      564              
  Lines       54403    54546     +143     
  Branches     8460     8476      +16     
==========================================
+ Hits        44938    45056     +118     
- Misses       7391     7403      +12     
- Partials     2074     2087      +13     
Flag Coverage Δ
keras 82.41% <81.25%> (+<0.01%) ⬆️
keras-jax 63.68% <62.50%> (-0.07%) ⬇️
keras-numpy 58.79% <37.50%> (-0.07%) ⬇️
keras-openvino 32.99% <33.33%> (+0.03%) ⬆️
keras-tensorflow 64.09% <58.33%> (-0.07%) ⬇️
keras-torch 63.76% <60.41%> (-0.08%) ⬇️

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.

@mattdangerw mattdangerw marked this pull request as ready for review April 28, 2025 18:43
@mattdangerw mattdangerw requested a review from fchollet April 28, 2025 18:49
I've wanted this tool for a while, figured I should just propose it.
Often I need to test out a script or colab I did not write, and just
want to run a few train steps without for every fit call without
finding every call to fit in the script. This adds a debugging tool
to do just that.

```
KERAS_MAX_EPOCHS=1 KERAS_MAX_STEPS=5 python train.py
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants