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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused on_train_epoch_end hook in accelerator #9035

Merged

Conversation

ananthsub
Copy link
Contributor

@ananthsub ananthsub commented Aug 22, 2021

What does this PR do?

We are auditing the Lightning components and APIs to assess opportunities for improvements:

No plugins or accelerators override this. Based on discussion in #9023: the plugins & accelerator API is not stable enough yet for it to warrant full backward compatibility. the blast radius of this change is small given none of the framework's implementations are affected. Therefore, I'm directly removing this hook instead of going through a full deprecation cycle.

A more composable, (currently half-baked) approach could be:

  • Split up ModelHooks into separate abstract classes that constitute pure interfaces.
  • By default the LightningModule implements these hooks with no-ops. These remain overridable by end-users.
  • Other components, like plugins, can also optionally implement these interfaces.
  • We could somehow leverage this stronger interface contract/typing in Trainer.call_hook to actually run these hooks for components that opt-into using them them (could be stronger than the hasattr checks we have now @carmocca )

Does your PR introduce any breaking changes? If yes, please list them.

Yes. This removes on_train_epoch_end from the accelerator API. Custom accelerators not directly provided by the framework which were overriding this will no longer have this method called.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

No plugins or accelerators override this
@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #9035 (e983aa0) into master (13e64e6) will decrease coverage by 4%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #9035    +/-   ##
=======================================
- Coverage      93%     89%    -4%     
=======================================
  Files         175     175            
  Lines       14397   14396     -1     
=======================================
- Hits        13340   12755   -585     
- Misses       1057    1641   +584     

@ananthsub ananthsub added this to the v1.5 milestone Aug 22, 2021
@mergify mergify bot added the ready PRs ready to be merged label Aug 22, 2021
@carmocca carmocca enabled auto-merge (squash) August 22, 2021 13:06
@carmocca carmocca merged commit 8a93173 into Lightning-AI:master Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Includes a breaking change ready PRs ready to be merged refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants