- fix: update citation author to full name (#43) (
4b0e88d
)
- fix: simplify build configuration and update citation format (#42) (
0839e21
)
- fix: trigger version bump (#41) (
2c72682
)
- chore: update project metadata and README for citation and versioning (#40) (
6834653
)
- fix: correct versioning for version in init.py (#39) (
bdb4545
)
- Revert "1.0.6"
This reverts commit 9244ca36814ae4a331b6477cb08edc0a91fc2609. (c96c7df
)
- fix: manual version bump (
0ea0305
)
- fix: Update semantic-release configuration for consistency and correct versioning (#38) (
0faabd0
)
- fix: correct version regex in semantic release config for version updates (#37) (
a3a82b2
)
- fix: semantic release version updating pattern (#36) (
ccda0f5
)
- fix: manual release and publish workflows with version updates (#35)
This PR updates both the release and publish workflows to:
- Ensure proper version updating across all package files
- Use manual triggers for better control and reliability
- Added
version: true
parameter to semantic-release action - This ensures updates to both
__init__.py
andpyproject.toml
versions - Kept explicit tag and push parameters for clarity
- Maintained all necessary permissions
- Changed from tag-based trigger to manual
workflow_dispatch
- Simplified workflow control and verification process
- Maintained all PyPI trusted publisher configurations
- Manual trigger of "Create New Release" workflow:
- Updates versions in package files
- Creates new tag and GitHub release
- Manual trigger of "Publish Python Package" workflow:
- Builds package with updated versions
- Publishes to PyPI (
45de9bb
)
- fix: improve release process and documentation (#34)
This PR improves the release process and documentation by:
- Makes tag pushing explicit in the release workflow
- Fixes version management in semantic release
- Updates README with PyPI installation instructions
- Added explicit tag pushing parameters to semantic-release workflow
- Updated version management in pyproject.toml:
- Added version_toml configuration
- Changed from dynamic to static versioning
- Set version to match current release (1.0.1)
- Updated README.md:
- Added PyPI installation instructions
- Fixed image URL for PyPI compatibility
- Reorganized installation and usage sections (
f42d5d1
)
- fix: use PyPI trusted publisher authentication (#33)
Updates the GitHub Actions publish workflow to use PyPI's Trusted Publisher authentication instead of token-based authentication. This change improves security by:
- Removing the need to store PyPI tokens in GitHub secrets
- Using OpenID Connect (OIDC) for secure authentication
- Leveraging PyPI's recommended authentication method for GitHub Actions
- Removed token-based authentication (TWINE_USERNAME and TWINE_PASSWORD)
- Added required
id-token: write
permission for OIDC - Switched from manual twine upload to
pypa/gh-action-pypi-publish
action (3a0d9b8
)
- chore!: rename package, restructure files, and add pip integration (#29)
This update introduces significant changes to the project, including renaming the package, restructuring the directory, and setting up automated publishing to PyPI using API tokens.
- Package Renaming:
- The package has been renamed from
pytorchtools
toearly_stopping_pytorch
for clearer naming and better alignment with its functionality.
- Directory Restructuring:
- Project files have been reorganized for clarity, with the source code
placed under the
early_stopping_pytorch/
directory in the root of the project.
- PyPI Integration:
- Added support for automated publishing to PyPI using GitHub Actions.
- API tokens are used for secure publishing, stored as GitHub
Secrets (
PYPI_TOKEN
).
-
Breaking Changes: Users will need to update their import paths from:
from pytorchtools import EarlyStopping
to:
from early_stopping_pytorch import EarlyStopping
-
New versions will be automatically published to PyPI when a new tag is pushed, using the API token for authentication. (
f9522dd
)
- fix: release workflow 2 (#32)
This PR modifies our Semantic Release workflow to ensure it's only triggered manually:
- Removed automatic trigger on push to main branch
- Retained only the
workflow_dispatch
trigger - Simplified job structure while maintaining all necessary steps and permissions
These changes provide more control over when releases are created, allowing us to:
- Prevent unintended automatic releases
- Manually initiate the release process when desired
- Maintain full functionality of the Semantic Release process (
ddc6493
)
- fix: release workflow (#31)
This PR updates our Semantic Release workflow to align with best practices and official documentation. Key changes include:
- Simplified the workflow to use the official Python Semantic Release GitHub Action.
- Adjusted permissions to ensure proper access for creating releases and tags.
- Updated pyproject.toml to prevent double publishing to PyPI.
These changes aim to:
- Streamline our release process
- Improve reliability and consistency of our versioning (
b291782
)
- fix: add check for NaN validation loss in EarlyStopping (#28)
This PR addresses an issue where EarlyStopping
incorrectly treats
nan
validation losses as an improvement, often caused by exploding
gradients.
Key changes:
- Added
np.isnan(val_loss)
check to ensure thatnan
validation losses are ignored. - Updated the logic to ensure that the patience counter and model
checkpointing are unaffected by
nan
values. - Introduced a new unit test,
test_validation_loss_nan
, to verify thatEarlyStopping
behaves correctly whennan
values are encountered during training.
Closes #16 (676686b
)
- chore: consolidate version definitions and update release workflow (#30)
This pull request consolidates version definitions and improves the release workflow to streamline the versioning and publishing processes. The changes are part of an effort to improve maintainability and ensure the workflows are efficient and modular.
Changes Made:
-
Consolidated Version Management:
-
Removed duplicate version definitions to maintain a single source of truth. The version is now only defined in
early_stopping_pytorch/__init__.py
to avoid conflicts. -
Removed the
version
field frompyproject.toml
, aspython-semantic-release
handles versioning automatically. -
Updated Release Workflow:
-
Improved the
Create New Release
workflow by separating the release process from the publishing process. -
The release process now handles version bumping, tagging, and creating GitHub releases via
python-semantic-release
. -
New Publish Workflow:
-
A dedicated workflow now handles publishing the package to PyPI when a new version tag is pushed.
-
This ensures a clear separation of responsibilities between creating releases and publishing to PyPI, reducing complexity. (
e79817a
)
- feat(ci): add GitHub Action for Python tests, fix EarlyStopping logic, and add unit tests (#27)
This PR introduces several key changes:
- A GitHub Actions workflow for continuous integration, running tests across multiple Python versions.
- Fixes to the
EarlyStopping
class logic, changingbest_score
tobest_val_loss
to improve clarity and correctness. - A new test suite for the
EarlyStopping
class to ensure its correct behavior after the logic fix.
-
Added Python application tests:
-
A new workflow named "Python Application Tests" runs on GitHub Actions.
-
Tests are executed across multiple Python versions (
3.9
,3.10
,3.11
,3.12
). -
The workflow is triggered on pushes and pull requests to the
main
branch.- Pip dependencies are cached to optimize performance.
-
Fixed EarlyStopping logic:
-
The variable
best_score
was renamed tobest_val_loss
for clarity, improving the code's readability and matching the purpose of the variable. -
Logic for early stopping was updated to properly handle edge cases for delta and stopping conditions based on validation loss behavior.
-
Added Unit Tests for
EarlyStopping
: -
The file
test_early_stopping.py
contains a thorough set of tests covering:- Initialization and attribute checks.
- Behavior when validation loss improves.
- Handling when validation loss does not improve.
- Proper functionality of patience and delta parameters.
- Edge cases for early stopping triggers and verbose output.
- Automates testing across different Python versions to ensure compatibility and reliability.
- Fixes logic issues in the
EarlyStopping
class, making it more robust and clear. - Ensures the
EarlyStopping
class functions as expected through the added unit tests. - Improves development velocity by automatically running tests on every
push and pull request. (
ffe12ee
)
- fix: wrong sign on delta argument
elif score < self.best_score - self.delta: -> elif score < self.best_score + self.delta: (7d8a086
)
- fix: remove pytorch
Seems like only torchvision is required (8644d65
)
- fix: remove version numbers
Could not find a version error on https://mybinder.org/
Try to fix the error by removing version numbers (8029865
)
- fix: format file for use with mybinder.org (
a144aff
)
-
chore: add requirement.txt (
2cdd950
) -
chore: add loss_plot.png (
f675463
) -
chore: add checkpoint.pt (
07a0221
) -
chore: add data/* to gitignore (
5aee053
)
- ci: add semantic versioning workflow (#26)
This PR introduces a manual semantic versioning process using python-semantic-release. It sets up a GitHub Actions workflow that can be manually triggered to determine the next version number, update the version in our code, create a new release, and generate release notes based on our commit history.
- Add
pyproject.toml
with semantic-release configuration - Update
pytorchtools.py
to include a__version__
variable, initially set to "0.1.0" - Add a new GitHub Actions workflow file:
.github/workflows/release.yml
for manual release triggering
- Provides a controlled, manual process for versioning and releasing
- Ensures consistent version numbering based on commit messages when releases are created
- Generates comprehensive release notes automatically
- Improves tracking of changes and features across versions
- Allows for dry-run releases to verify the process without making changes
- Starting version: 0.1.0
- Semantic Versioning: Using
major_on_zero = false
to treat 0.x versions similarly to 1.x versions - Release Process: Manual trigger through GitHub Actions, with option for dry-run
- This change does not affect the existing functionality of the EarlyStopping class
To create a new release:
- Ensure all desired changes are merged to the main branch
- Go to the "Actions" tab in the GitHub repository
- Select the "Create New Release" workflow
- Click "Run workflow"
- Choose whether to perform a dry run or create an actual release
- Review the results in the Actions tab and in the Releases section of the repository
- Evaluate the need for automatic releases based on project growth and development pace
- Consider implementing additional checks or approvals before releases
are created (
686db54
)
- ci: add PR title linting workflow (#25)
This PR introduces a GitHub Actions workflow to lint Pull Request titles. The workflow ensures that all PR titles follow the Conventional Commits specification, which will improve our changelog generation and semantic versioning process.
- Add a new GitHub Actions workflow file:
.github/workflows/pr-title-lint.yml
- Configure the workflow to run on PR creation, edit, and synchronization
- Use the
amannn/action-semantic-pull-request
action to validate PR titles
- Enforces consistent and meaningful PR titles
- Facilitates automated versioning and changelog generation
- Improves clarity and communication in our development process
- This change does not affect the existing codebase or functionality (
0003e63
)
-
docs: create CODE_OF_CONDUCT.md (
0e22ef3
) -
docs: add usage section
Add a link to mybinder.org to run the project in the browser. (abcd4ed
)
-
docs: fix minor errors in the text (
f15c2a8
) -
docs: fix punctuation (
745fdba
) -
docs: add the loss_plot and write a better explenation (
68529d6
) -
docs: write introduction (
bae0775
)
- feat: create MNIST_Early_Stopping_example notebook
Notebook with an example of how to use the EarlyStopping class (5102fa5
)
-
feat: add verbose argument to EarlyStopping class (
d64801f
) -
feat: change checkpoint save path
'saved_models/checkpoint.pt' --> 'checkpoint.pt' (11da3df
)
-
feat: import torch and numpy (
b345d0b
) -
feat: add EarlyStopping class (
9c7d9e6
) -
feat: create pytorchtools.py (
7396b39
)
- Merge pull request #9 from eddinho/custum_trace_function
add a custom trace print function to earlEarlyStopping class (f1a4cad
)
-
add a custom trace print function to earlEarlyStopping class (
3a28f68
) -
Merge pull request #7 from SimonMossmyr/patch-1
Add path argument to EarlyStopping init (7ec86aa
)
- Add path argument to EarlyStopping init
Add an argument to the class initialization that specifies where the checkpoint model is saved to. Defaults to 'checkpoint.pt'. (321aa0d
)
- Merge pull request #4 from wolframalpha/master
Update pytorchtools.py (effbcce
)
-
Update pytorchtools.py (
780b1dc
) -
Merge pull request #2 from AdilZouitine/master
Add delta argument (36cff88
)
-
add delta (
dfe8e45
) -
Merge pull request #1 from anshulrai/patch-1
Checkpoint model after first score improvement (fbcd638
)
-
Update pytorchtools.py (
ffb781e
) -
Checkpoint model after first score improvement
To get expected output in cases where validation loss doesn't improve after fist epoch.
Example of bug:
Epoch 1/5 loss=140.3084 val_loss=118.2384 time=105.34s
Epoch 2/5 loss=120.4707 val_loss=120.7402 time=109.57s
Validation loss decreased (inf --> 120.7402). Saving model ... (826f803
)