mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-23 08:05:28 +08:00
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:
1 parent
8b9574bb5a
commit
814db32ec4
53 files changed
+386
-205
No files matched your search
@@ -24,7 +24,7 @@ import time
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from threading import Lock
|
||||
from typing import Dict, List, Literal, Optional, Tuple, Type, Union
|
||||
from typing import Dict, List, Literal, Optional, Tuple, Type, cast
|
||||
|
||||
import torch
|
||||
from rich import box, style
|
||||
@@ -54,7 +54,7 @@ from nerfstudio.viewer.server.viewer_state import ViewerState
|
||||
TRAIN_INTERATION_OUTPUT = Tuple[ # pylint: disable=invalid-name
|
||||
torch.Tensor, Dict[str, torch.Tensor], Dict[str, torch.Tensor]
|
||||
]
|
||||
TORCH_DEVICE = Union[torch.device, str] # pylint: disable=invalid-name
|
||||
TORCH_DEVICE = str # pylint: disable=invalid-name
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -374,8 +374,8 @@ class Trainer:
|
||||
|
||||
def _load_checkpoint(self) -> None:
|
||||
"""Helper function to load pipeline and optimizer from prespecified checkpoint"""
|
||||
load_dir: Path = self.config.load_dir
|
||||
load_checkpoint: Path = self.config.load_checkpoint
|
||||
load_dir = self.config.load_dir
|
||||
load_checkpoint = self.config.load_checkpoint
|
||||
if load_dir is not None:
|
||||
load_step = self.config.load_step
|
||||
if load_step is None:
|
||||
@@ -459,7 +459,7 @@ class Trainer:
|
||||
metrics_dict[f"Gradients/{tag}"] = grad
|
||||
total_grad += grad
|
||||
|
||||
metrics_dict["Gradients/Total"] = total_grad
|
||||
metrics_dict["Gradients/Total"] = cast(torch.Tensor, total_grad)
|
||||
|
||||
scale = self.grad_scaler.get_scale()
|
||||
self.grad_scaler.update()
|
||||
|
||||
Reference in new issue
Block a user