Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure_callbacks hook for LightningModule #5615

Closed
awaelchli opened this issue Jan 22, 2021 · 2 comments 路 Fixed by #5621
Closed

configure_callbacks hook for LightningModule #5615

awaelchli opened this issue Jan 22, 2021 · 2 comments 路 Fixed by #5621
Assignees
Labels
callback feature Is an improvement or enhancement help wanted Open to be worked on priority: 0 High priority task
Milestone

Comments

@awaelchli
Copy link
Member

馃殌 Feature

Motivation

Provide model-specific callbacks in a LightningModule

Pitch

Add a configure_callbacks method to LightningModule
Append the returned callbacks to the trainer callbacks.

Additional context

cc @edenlightning

@awaelchli awaelchli added feature Is an improvement or enhancement help wanted Open to be worked on callback labels Jan 22, 2021
@awaelchli awaelchli added this to the 1.2 milestone Jan 22, 2021
@awaelchli awaelchli changed the title configure_callbacks configure_callbacks hook for LightningModule Jan 22, 2021
@awaelchli awaelchli self-assigned this Jan 22, 2021
@edenlightning
Copy link
Contributor

Improvements:

  • Supporting priorities for callbacks

CallbackA(priority=1)
CallbackB(priority=1)
CallbackC(priority=2)
In this case, A, B are called sequentially (order does not matter between A, B because both are priority 1.

And C is called after

A, B
C
or

B, A
C

@edenlightning
Copy link
Contributor

Another improvments: Support child callbacks, to customize callback order

As a user, I want callbacks to be called in a specific order.

a = CallbackA()
b = CallbackB()
c = CallbackC()
d = CallbackD()

a.child_callback(b)
a.child_callback(c)
c.chold_callback(d)
The dag looks like:

a -> B
-> C -> D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
callback feature Is an improvement or enhancement help wanted Open to be worked on priority: 0 High priority task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants