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

torch.Tensor for optimizer parameters #127699

Open
ad8e opened this issue Jun 2, 2024 · 0 comments
Open

torch.Tensor for optimizer parameters #127699

ad8e opened this issue Jun 2, 2024 · 0 comments
Labels
module: optimizer Related to torch.optim needs design triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@ad8e
Copy link
Contributor

ad8e commented Jun 2, 2024

🚀 The feature, motivation and pitch

The LR allows torch.Tensor, see: #120934 (comment)

But the other parameters don't, such as AdamW's beta2.

This causes torch.compile to fail (fallback to eager) when I compile an optimizer with changing parameters, since torch.compile does not allow non-constant floats.

Allowing changing the other (non-LR) parameters would be helpful because:

  1. beta1 (momentum) needs a scheduler as the eigenvalue distribution changes
  2. beta2 needs a scheduler when finetuning a model, if the optimizer states aren't loaded or if the data distribution changes. Otherwise, a long warmup is required (~200-1000 steps depending on beta2). I'm currently having problems with DCP optimizer saving, so this matters to me.
  3. weight decay needs a scheduler if the math is done correctly

Alternatives

Either torch.compile working with floats or AdamW allowing torch.tensor params would work for me.

Additional context

No response

cc @vincentqb @jbschlosser @albanD @janeyx99 @crcrpar

@cpuhrsch cpuhrsch added module: optimizer Related to torch.optim triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: optimizer Related to torch.optim needs design triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants