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

Making it possible to set optimizer and scheduler instances via PyTorch model properties for training #1187

Merged
merged 7 commits into from
Jul 11, 2023

Conversation

gabrielspmoreira
Copy link
Member

Goals ⚽

  • Make it possible to user learning rate schedulers for training MM PyTorch models

Implementation Details 🚧

  • Currently it is possible to provide an Optimizer class in the PyTorch model constructor, which is instantiated within the standard PyT Lightning method configure_optimizers() with the model.parameters().
  • The learning rate scheduler constructor needs the optimizer instance, as well as other required arguments, so it cannot be provided as constructor argument if the optimizer instance is created within configure_optimizers() method.
  • This PR makes it possible to provide Optimizer and Scheduler instances via properties, so that the user has more flexibility to instantiate those objects, including cases where different optimizers are used for different parameters.

Testing Details 🔍

  • Added the test_init_optimizer_and_scheduler_instances_via_property

@gabrielspmoreira gabrielspmoreira self-assigned this Jul 6, 2023
@gabrielspmoreira gabrielspmoreira added the enhancement New feature or request label Jul 6, 2023
@gabrielspmoreira gabrielspmoreira added this to the Merlin 23.07 milestone Jul 6, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Documentation preview

https://nvidia-merlin.github.io/models/review/pr-1187

@marcromeyn marcromeyn merged commit 8a9e5ea into main Jul 11, 2023
37 checks passed
@marcromeyn marcromeyn deleted the torch/model_opt branch July 11, 2023 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pytorch enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants