Fix tensorf chkpt loading (#1266)

* setting tensorf default from wandb to viewer

* adding functionality to adjust model depending on the step of the checkpoint that is loaded

* cleaning code

* bug fix

* fixing style
This commit is contained in:
Terrance Wang authored and GitHub committed 2023-01-20 12:00:51 -08:00
1 parent 9eb880aa91
commit 73bffe058f
4 files changed
+29 -4

No files matched your search

+5 -2
View File
@@ -158,11 +158,12 @@ class Pipeline(nn.Module):
def get_average_eval_image_metrics(self, step: Optional[int] = None):
"""Iterate over all the images in the eval dataset and get the average."""
def load_pipeline(self, loaded_state: Dict[str, Any]) -> None:
def load_pipeline(self, loaded_state: Dict[str, Any], step: int) -> None:
"""Load the checkpoint from the given path
Args:
loaded_state: pre-trained model state dict
step: training step of the loaded checkpoint
"""
def get_training_callbacks(
@@ -352,13 +353,15 @@ class VanillaPipeline(Pipeline):
self.train()
return metrics_dict
def load_pipeline(self, loaded_state: Dict[str, Any]) -> None:
def load_pipeline(self, loaded_state: Dict[str, Any], step: int) -> None:
"""Load the checkpoint from the given path
Args:
loaded_state: pre-trained model state dict
step: training step of the loaded checkpoint
"""
state = {key.replace("module.", ""): value for key, value in loaded_state.items()}
self._model.update_to_step(step)
self.load_state_dict(state, strict=False)
def get_training_callbacks(