Skip to content

Commit 48cb92b

Browse files
committed
feat: add extra model groups
1 parent a3aad45 commit 48cb92b

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @package model.parameters.groups.model_groups4
2+
3+
_target_: moai.parameters.selectors.model_groups.ModelGroupParameterSelector
4+
groups: ???
5+
# each group (key-dict pair) contains
6+
# modules: null # optional
7+
# monads: null # optional
8+
# parameters: null # optional
9+
# force_grad: true
10+
# and extra optimizer relaed params
11+
# lr: float
12+
# etc.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @package model.parameters.groups.model_groups5
2+
3+
_target_: moai.parameters.selectors.model_groups.ModelGroupParameterSelector
4+
groups: ???
5+
# each group (key-dict pair) contains
6+
# modules: null # optional
7+
# monads: null # optional
8+
# parameters: null # optional
9+
# force_grad: true
10+
# and extra optimizer relaed params
11+
# lr: float
12+
# etc.

moai/core/model.py

+1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def closure(tensors, index, steps, stage, optimizer, objective):
289289
optimizer,
290290
)
291291
call._call_strategy_hook(self.trainer, "backward", loss, optimizer)
292+
# NOTE: https://pytorch.org/docs/main/generated/torch.optim.Optimizer.zero_grad.html#torch.optim.Optimizer.zero_grad
292293
self.optimization_step += 1
293294
if monitor := toolz.get_in(
294295
[C._FIT_, C._OPTIMIZATION_STEP_, stage], self.monitor

moai/monads/render/nvdiffrast/render.py

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def forward(
6464
attributes: typing.Optional[torch.Tensor] = None,
6565
) -> typing.Dict[str, torch.Tensor]:
6666
nz_indices = torch.nonzero(triangle_ids[..., -1], as_tuple=True)
67+
# NOTE: reconsider nonzero as it seems to be a blocking call
6768
out = {
6869
"indices": dict((str(i), t) for i, t in enumerate(nz_indices)),
6970
"triangles": {"id": triangle_ids[nz_indices]},

moai/nn/convolution/torch/standard.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(
2727
out_channels=out_features,
2828
**convolution_params # TODO: either merge kwargs here or in the factory method
2929
)
30+
# https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html#disable-bias-for-convolutions-directly-followed-by-a-batch-norm
3031
self.activation = mia.make_activation(
3132
features=out_features, activation_type=activation_type, **activation_params
3233
)

0 commit comments

Comments
 (0)