mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-26 02:49:57 +08:00
Serializing JSON code for drawable objects (and some documentation) (#222)
* some comments and starting serializing comments. on plane w/o formatter * fixing pylint and black * removed changes in file * revert file * addressing comments * remove abstract Co-authored-by: Ethan Weber <ethanweber@Ethans-MacBook-Pro.local>
This commit is contained in:
1 parent
44a7fa288c
commit
d13a766b9e
13 files changed
+240
-106
No files matched your search
@@ -44,7 +44,7 @@ logging.getLogger("PIL").setLevel(logging.WARNING)
|
||||
|
||||
|
||||
class Trainer:
|
||||
"""Training class
|
||||
"""Trainer class
|
||||
|
||||
Args:
|
||||
config (Config): The configuration object.
|
||||
@@ -74,8 +74,9 @@ class Trainer:
|
||||
profiler.setup_profiler(config.logging)
|
||||
# visualizer variable
|
||||
self.visualizer_state = viewer_utils.VisualizerState(config.viewer)
|
||||
|
||||
self.grad_scaler = GradScaler(enabled=self.mixed_precision)
|
||||
# training callbacks
|
||||
self.callbacks = None
|
||||
|
||||
def setup(self, test_mode=False):
|
||||
"""Setup the Trainer by calling other setup functions.
|
||||
@@ -95,7 +96,7 @@ class Trainer:
|
||||
self.graph = DDP(self.graph, device_ids=[self.local_rank])
|
||||
dist.barrier(device_ids=[self.local_rank])
|
||||
|
||||
self.graph.register_callbacks()
|
||||
self.callbacks = self.graph.get_training_callbacks()
|
||||
|
||||
@classmethod
|
||||
def get_aggregated_loss(cls, loss_dict: Dict[str, torch.Tensor]) -> torch.Tensor:
|
||||
@@ -203,9 +204,8 @@ class Trainer:
|
||||
self.grad_scaler.update()
|
||||
|
||||
self.optimizers.scheduler_step_all(step)
|
||||
if self.graph.callbacks:
|
||||
for func_ in self.graph.callbacks:
|
||||
func_.after_step(step)
|
||||
for callback in self.callbacks:
|
||||
callback.after_step(step)
|
||||
|
||||
# Merging loss and metrics dict into a single output.
|
||||
loss_dict["loss"] = loss
|
||||
|
||||
Reference in new issue
Block a user