Skip to content

Releases: Bjarten/early-stopping-pytorch

v1.0.0

18 Oct 08:20
Compare
Choose a tag to compare

v1.0.0 (2024-10-18)

Breaking

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

Key Changes:

  1. Package Renaming:
  • The package has been renamed from pytorchtools to
    early_stopping_pytorch for clearer naming and better alignment with
    its functionality.
  1. 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.
  1. 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).

Impact:

  • 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)

Bug Fixes

  • fix: release workflow 2 (#32)

This PR modifies our Semantic Release workflow to ensure it's only
triggered manually:

  1. Removed automatic trigger on push to main branch
  2. Retained only the workflow_dispatch trigger
  3. 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:

  1. Simplified the workflow to use the official Python Semantic Release
    GitHub Action.
  2. Adjusted permissions to ensure proper access for creating releases
    and tags.
  3. 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 that nan 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 that
    EarlyStopping behaves correctly when nan values are encountered
    during training.

Closes #16 (676686b)

Chores

  • 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 from pyproject.toml, as
    python-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)

Features

  • feat(ci): add GitHub Action for Python tests, fix EarlyStopping logic, and add unit tests (#27)

This PR introduces several key changes:

  1. A GitHub Actions workflow for continuous integration, running tests
    across multiple Python versions.
  2. Fixes to the EarlyStopping class logic, changing best_score to
    best_val_loss to improve clarity and correctness.
  3. A new test suite for the EarlyStopping class to ensure its correct
    behavior after the logic fix.

Changes:

  • 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 to best_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.

Why this change is important:

  • 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)

Initial Release v0.1.0

14 Oct 04:31
686db54
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/Bjarten/early-stopping-pytorch/commits/v0.1.0