-
Notifications
You must be signed in to change notification settings - Fork 2
0.2.1 RC #4
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
Merged
Merged
0.2.1 RC #4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add [project.optional-dependencies] with a telegram extra (python-telegram-bot>=22.3). - Remove the telegram entry from [dependency-groups]. - Consumers should now install via extras, e.g. pip install .[telegram]. Commit message generated by GPT-5
- Add _sanitize_value and sanitize_dict_like_object to ensure hyperparams/metrics are JSON-serializable. - Pretty-print sanitized hyperparams in log_hyperparams. - Add @OverRide annotations and save_dir property. - Minor: adjust val_* metric spacing and refine type hints. Commit message generated by GPT-5
- Replace _LRScheduler with LRScheduler in imports, bases, and type hints - BaseLRScheduler now derives from LRScheduler - MultiStageScheduler now sets optimizer from first sub-scheduler, avoids super().__init__, and calls _initial_step() for initial LRs Commit message generated by GPT-5
- Do not report eval metrics during sanity validation (global_step == 0). - Read metrics from trainer.logged_metrics instead of logger_connector for compatibility with newer PyTorch lightning. - Remove unnecessary deepcopy import and copying. - Update unit tests to use .kwargs, rename test class. - Add integration test verifying start, per-epoch metrics, and finish messages. - Document why on_exception is disabled (event loop closes on shutdown). Commite message partly generated by GPT-5
- Replace asyncio.run(...) with event_loop.run_until_complete(...) for sending Telegram messages. - Re-enable on_exception to notify on training errors. Commit message generated by GPT-5y
and improve docs/warnings - Rename internal metric state from `target` to `targets` for clarity and consistency - Add typing casts around `self.preds`/`self.targets` to satisfy static type checkers - Standardize `process_group` type hints to `Any` with `None` default - AUC: - Add initialization warning clarifying specialized behavior and directing to `BinaryAUROC` - Refactor compute to use local lists/tensors and clearer variable names - SpearmanCorrelation: - Refactor compute with explicit casts and local vars - Add pyright ignore where necessary for Spearman’s correlation access - FBeta: - Expand docstring with binary and multiclass behavior caveats - Add warning clarifying specialized behavior and recommending torchmetrics’ FBeta for general cases - Refactor compute with explicit casts and clearer naming These changes improve clarity, type safety, and user guidance while preserving runtime behavior. Commit message generated by GPT-5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview of the Changes
This pull request introduces a major modernization of the project's tooling, dependency management, and testing infrastructure. The build system has been migrated from
setup.py
to the standardpyproject.toml
, and the CI/CD pipeline has been overhauled to useuv
for significantly faster dependency management. A comprehensive test suite for the callback modules has been added, greatly improving code reliability.Furthermore, the request includes numerous enhancements and bug fixes across the library, such as updating the
TelegramCallback
to work with modern libraries, improving the clarity and type safety of custom metrics, and migrating to the latest PyTorchLRScheduler
API.Key Changes
Project Modernization & Tooling
setup.py
topyproject.toml
, adopting the modern standard for Python packaging.uv
for dependency installation, which is significantly faster than the previousconda
/pip
setup. Aruff
linting step has also been added to enforce code quality.ruff
for code formatting and linting, with configuration added in a new.pre-commit-config.yaml
file to automate style guide adherence.Comprehensive Testing
test_callbacks.py
, has been created, adding extensive unit and integration tests for all callbacks.TelegramCallback
now useunittest.mock.AsyncMock
to avoid making real network calls.LookaheadCallback
andLookaheadModelCheckpoint
verify correct parameter swapping and checkpointing behavior.MixUp
,CutMix
,SnapMix
) have been added to ensure their transformations are applied correctly.Callback Improvements
TelegramCallback
:event_loop.run_until_complete
for compatibility with the latestpython-telegram-bot
library.trainer.logged_metrics
for better compatibility with newer PyTorch Lightning versions.on_exception
hook has been re-enabled to report training failures.LookaheadCallback
&LookaheadModelCheckpoint
:Lookahead
, preventing incorrect usage and silent failures.RandomAugmentationChoiceCallback
:np.random.choice
withrandom.choices
for better performance and consistency.Metrics Module Refinements
GlobalMetric
class has been updated to align with recent changes intorchmetrics
, removing the deprecatedcompute_on_step
parameter.target
totargets
for improved clarity.AUC
andFBeta
metrics now issue warnings on initialization to clarify their specialized behavior (coalescing classes) and recommend standardtorchmetrics
alternatives for general use cases.compute
methods has been refactored for better readability and type safety using explicit casts.Other Notable Enhancements
ScreenLogger
: Enhanced to sanitize hyperparameters, ensuring all values are JSON-serializable before being pretty-printed to the console._LRScheduler
to the publictorch.optim.lr_scheduler.LRScheduler
API.README.md
file has been updated with a disclaimer,uv
installation instructions, and a new "Release Notes" section.New Dependencies Added
hatchling
: Added as the build backend inpyproject.toml
.pytest
,pytest-env
: Formalized as development dependencies for running the new test suite.python-telegram-bot
: Defined as an optional dependency under the[telegram]
extra, so it is only installed when needed.Disclosure: the above pull request was written with the assistance of Gemini 2.5 Pro