Multi-gpu improvements (#799)

* initial commit

* minor changes

* small changes

* ddp seems to be working

* remove commented out code
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-10-20 01:11:40 -07:00
1 parent 863fc77ab5
commit 6f4fb506e2
8 files changed
+93 -107

No files matched your search

+2 -16
View File
@@ -21,7 +21,7 @@ import dataclasses
import functools
import os
import time
from typing import Any, Dict, List, Tuple
from typing import Dict, List, Tuple
import torch
from rich.console import Console
@@ -48,20 +48,6 @@ from nerfstudio.viewer.server import viewer_utils
CONSOLE = Console(width=120)
def train_loop(local_rank: int, world_size: int, config: cfg.Config) -> Any:
"""Main training function that sets up and runs the trainer per process
Args:
local_rank: current rank of process
world_size: total number of gpus available
config: config file specifying training regimen
"""
trainer = Trainer(config, local_rank, world_size)
trainer.setup()
trainer.train()
return 0
class Trainer:
"""Trainer class
@@ -122,7 +108,7 @@ class Trainer:
Args:
test_mode: Whether to setup for testing. Defaults to False.
"""
self.pipeline: VanillaPipeline = self.config.pipeline.setup(
self.pipeline = self.config.pipeline.setup(
device=self.device, test_mode=test_mode, world_size=self.world_size, local_rank=self.local_rank
)
self.optimizers = setup_optimizers(self.config, self.pipeline.get_param_groups())