MCPcopy Create free account
hub / github.com/VAST-AI-Research/TriplaneGaussian / __init__

Method __init__

tgs/utils/base.py:96–117  ·  view source on GitHub ↗
(
        self, cfg: Optional[Union[dict, DictConfig]] = None, *args, **kwargs
    )

Source from the content-addressed store, hash-verified

94 cfg: Config # add this to every subclass of BaseModule to enable static type checking
95
96 def __init__(
97 self, cfg: Optional[Union[dict, DictConfig]] = None, *args, **kwargs
98 ) -> None:
99 super().__init__()
100 self.cfg = parse_structured(self.Config, cfg)
101 self.device = get_device()
102 self._non_modules = {}
103 self.configure(*args, **kwargs)
104 if self.cfg.weights is not None:
105 # format: path/to/weights:module_name
106 weights_path, module_name = self.cfg.weights.split(":")
107 state_dict = load_module_weights(
108 weights_path, module_name=module_name, map_location="cpu"
109 )
110 self.load_state_dict(state_dict, strict=False)
111 # self.do_update_step(
112 # epoch, global_step, on_load_weights=True
113 # ) # restore states
114
115 if self.cfg.freeze:
116 for params in self.parameters():
117 params.requires_grad = False
118
119 def configure(self, *args, **kwargs) -> None:
120 pass

Callers

nothing calls this directly

Calls 5

configureMethod · 0.95
parse_structuredFunction · 0.90
get_deviceFunction · 0.90
load_module_weightsFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected