-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Callback collection through entry points #12739
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
Changes from 13 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
d139467
fix version comparison for python version
awaelchli 7c3f93e
add doctest
awaelchli 99d7eaf
load callback factories from entry point
awaelchli a3b4c3a
docs for entry points
awaelchli 15d2352
formatting
awaelchli a4bc246
docs
awaelchli a6c9569
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3eb6253
handle empty entry points
awaelchli 088e7f3
add log
awaelchli d44a7de
wip test
awaelchli 8735d4c
wip
awaelchli 785da7d
tests
awaelchli af6f15e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 62652f2
fix import
awaelchli e903737
Merge remote-tracking branch 'origin/feature/callback-entry-points' i…
awaelchli f085185
Merge branch 'master' into feature/callback-entry-points
awaelchli a80b0b5
reset
awaelchli a248e05
update changelog
awaelchli 85ef5c3
Merge branch 'master' into feature/callback-entry-points
awaelchli 3c7aa32
Merge branch 'master' into feature/callback-entry-points
awaelchli d10be0d
update title level
awaelchli 8dae38f
extract docs
awaelchli 22fafc6
Merge branch 'master' into feature/callback-entry-points
awaelchli 1942933
Update CHANGELOG.md
awaelchli caf5cac
Update docs/source/extensions/entry_points.rst
awaelchli 8dbfd3b
Update docs/source/extensions/entry_points.rst
awaelchli e51f95f
Update docs/source/extensions/entry_points.rst
awaelchli 1ac8b55
Merge remote-tracking branch 'origin/feature/callback-entry-points' i…
awaelchli 8418a80
import locally
awaelchli b5be0bc
split double call
awaelchli 614642a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8d08724
add uninstallation guide
awaelchli 219025d
Revert "import locally"
awaelchli 661e8d0
fix test
awaelchli da04388
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] dbb40b3
support Callback as direct return value
awaelchli 049b68d
fix typo in error message
awaelchli 419e995
revert error handling
awaelchli 7cee194
move method to function
awaelchli f2ea314
Import locally
carmocca 79be51c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b95406b
Remove monkeypatch
carmocca 81e8c4a
Update tests/trainer/connectors/test_callback_connector.py
carmocca 48422ea
Merge branch 'master' into feature/callback-entry-points
carmocca 7ce5601
Apply suggestions from code review
carmocca 1602f82
Merge branch 'master' into feature/callback-entry-points
carmocca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pytorch_lightning.callbacks import Callback | ||
|
||
|
||
class MyPrintingCallback(Callback): | ||
def on_train_start(self, trainer, pl_module): | ||
print("Training is starting") | ||
|
||
def on_train_end(self, trainer, pl_module): | ||
print("Training is ending") | ||
|
||
|
||
def my_callbacks_factory(): | ||
return [MyPrintingCallback()] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name="my-package", | ||
version="0.0.1", | ||
# entry_points={ | ||
# "pytorch_lightning.callbacks_factory": [ | ||
# # The format here must be [any name]=[module path]:[function name] | ||
# "monitor_callbacks=factories:my_callbacks_factory" | ||
# ] | ||
# }, | ||
) |
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
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
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 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.
Uh oh!
There was an error while loading. Please reload this page.