More typing fixes (#1941)

* Fix more types

* Fix tests

* Minor cleaning

* Address comments

* Resolve linting errors

* Re-ignore pymeshlab type

* Add extra assert / error message to mipnerf model
This commit is contained in:
Brent Yi authored and GitHub committed 2023-05-17 07:17:40 -07:00
1 parent 8b9574bb5a
commit 814db32ec4
53 files changed
+386 -205

No files matched your search

+2
View File
@@ -186,11 +186,13 @@ class Pipeline(nn.Module):
step: training step of the loaded checkpoint
"""
@abstractmethod
def get_training_callbacks(
self, training_callback_attributes: TrainingCallbackAttributes
) -> List[TrainingCallback]:
"""Returns the training callbacks from both the Dataloader and the Model."""
@abstractmethod
def get_param_groups(self) -> Dict[str, List[Parameter]]:
"""Get the param groups for the pipeline.
+3 -1
View File
@@ -84,11 +84,12 @@ class DynamicBatchPipeline(VanillaPipeline):
"'num_samples_per_batch' is not in metrics_dict."
"Please return 'num_samples_per_batch' in the models get_metrics_dict function to use this method."
)
self._update_dynamic_num_rays_per_batch(metrics_dict["num_samples_per_batch"])
self._update_dynamic_num_rays_per_batch(int(metrics_dict["num_samples_per_batch"]))
self._update_pixel_samplers()
# add the number of rays
assert "num_rays_per_batch" not in metrics_dict
assert self.datamanager.train_pixel_sampler is not None
metrics_dict["num_rays_per_batch"] = torch.tensor(self.datamanager.train_pixel_sampler.num_rays_per_batch)
return model_outputs, loss_dict, metrics_dict
@@ -98,6 +99,7 @@ class DynamicBatchPipeline(VanillaPipeline):
# add the number of rays
assert "num_rays_per_batch" not in metrics_dict
assert self.datamanager.eval_pixel_sampler is not None
metrics_dict["num_rays_per_batch"] = torch.tensor(self.datamanager.eval_pixel_sampler.num_rays_per_batch)
return model_outputs, loss_dict, metrics_dict