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

Optimizers.scheduler_step() bug fix #2352

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

JADGardner
Copy link
Contributor

I believe there is a bug in the Optimizers.scheduler_step() method:

Calling Optimizers.scheduler_step() results in the error:

'dict' object has no attribute 'param_group_name'

Here is a minimal script to produce the error:

import torch
from nerfstudio.engine.optimizers import Optimizers, AdamOptimizerConfig
from nerfstudio.engine.schedulers import ExponentialDecaySchedulerConfig

optimizers_config = {
    "fields": {
        "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
        "scheduler": ExponentialDecaySchedulerConfig(lr_final=0.0001, max_steps=200000),
    }
}

dummy_params = [torch.tensor([42.0])]
param_groups = {"fields": dummy_params}

optimizer = Optimizers(optimizers_config, param_groups)
optimizer.optimizer_step("fields")
optimizer.scheduler_step("fields")

Copy link
Contributor

@tancik tancik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@tancik tancik merged commit cba8d22 into nerfstudio-project:main Aug 18, 2023
4 checks passed
@JADGardner JADGardner deleted the scheduler_bugfix branch August 19, 2023 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants