brainstorming trainer code but broken

This commit is contained in:
Ethan Weber committed 2022-04-06 22:45:53 +00:00
1 parent a9c0d5b97f
commit a7167f890e
9 files changed
+166 -31

No files matched your search

+35 -14
View File
@@ -1,11 +1,33 @@
from abc import abstractmethod
import logging
import torch
from mattport.nerf.optimizer import Optimizer
from mattport.nerf.graph import Graph
from mattport.nerf.dataset.build import build_dataset
class Trainer(object):
def __init__(self, config: None):
def __init__(self, config: dict):
self.config = config
self.optimizer = None
def setup_dataset(self):
"""_summary_
"""
self.train_dataset = build_dataset(self.config.dataset)
self.test_dataset = build_dataset(self.config.dataset)
def setup_graph(self):
"""_summary_
"""
self.graph = Graph(
encodings_config=self.config.encodings,
renderer_config=self.config.renderer,
loss_config=self.config.loss
)
def setup_optimizer(self):
self.optimizer = Optimizer(params=self.graph.parameters(), **self.config.optimizer)
def load_checkpoint(self):
"""_summary_
@@ -13,7 +35,7 @@ class Trainer(object):
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
raise NotImplementedError
def save_checkpoint(self):
"""_summary_
@@ -21,17 +43,16 @@ class Trainer(object):
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
def load_dataset(self):
"""_summary_
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
raise NotImplementedError
def train(self):
"""_summary_"""
# TODO(ethan): replace print statements with something more proper
logging.info("train function")
pass
def train_epoch(self):
"""_summary_"""
pass
def train_iteration(self):
"""_summary_"""
pass