mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-17 21:33:56 +08:00
NeusFacto (#1654)
* add neus_facto method * fix missing pixsfm from video process * fix dev errors and small typos --------- Co-authored-by: Ethan Weber <eweb0124@gmail.com>
This commit is contained in:
1 parent
fd6cc84808
commit
8126d47d8c
7 files changed
+348
-4
No files matched your search
@@ -18,7 +18,7 @@
|
||||
|
||||
from abc import abstractmethod
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional, Type
|
||||
from typing import Optional, Tuple, Type
|
||||
|
||||
import numpy as np
|
||||
from torch.optim import Optimizer, lr_scheduler
|
||||
@@ -56,6 +56,34 @@ class Scheduler:
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class MultiStepSchedulerConfig(SchedulerConfig):
|
||||
"""Config for multi step scheduler where lr decays by gamma every milestone"""
|
||||
|
||||
_target: Type = field(default_factory=lambda: MultiStepScheduler)
|
||||
"""target class to instantiate"""
|
||||
max_steps: int = 1000000
|
||||
"""The maximum number of steps."""
|
||||
gamma: float = 0.33
|
||||
"""The learning rate decay factor."""
|
||||
milestones: Tuple[int, ...] = (500000, 750000, 900000)
|
||||
"""The milestone steps at which to decay the learning rate."""
|
||||
|
||||
|
||||
class MultiStepScheduler(Scheduler):
|
||||
"""Multi step scheduler where lr decays by gamma every milestone"""
|
||||
|
||||
config: MultiStepSchedulerConfig
|
||||
|
||||
def get_scheduler(self, optimizer: Optimizer, lr_init: float) -> lr_scheduler._LRScheduler:
|
||||
scheduler = lr_scheduler.MultiStepLR(
|
||||
optimizer=optimizer,
|
||||
milestones=self.config.milestones,
|
||||
gamma=self.config.gamma,
|
||||
)
|
||||
return scheduler
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExponentialDecaySchedulerConfig(SchedulerConfig):
|
||||
"""Config for exponential decay scheduler with warmup"""
|
||||
@@ -111,7 +139,7 @@ class ExponentialDecayScheduler(Scheduler):
|
||||
|
||||
@dataclass
|
||||
class CosineDecaySchedulerConfig(SchedulerConfig):
|
||||
"""Basic scheduler config with self-defined exponential decay schedule"""
|
||||
"""Config for cosine decay schedule"""
|
||||
|
||||
_target: Type = field(default_factory=lambda: CosineDecayScheduler)
|
||||
"""target class to instantiate"""
|
||||
@@ -124,7 +152,7 @@ class CosineDecaySchedulerConfig(SchedulerConfig):
|
||||
|
||||
|
||||
class CosineDecayScheduler(Scheduler):
|
||||
"""Starts with a flat lr schedule until it reaches N epochs then applies a given scheduler"""
|
||||
"""Cosine decay scheduler with linear warmup"""
|
||||
|
||||
config: CosineDecaySchedulerConfig
|
||||
|
||||
|
||||
Reference in new issue
Block a user