MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / _count_all_layer_params

Function _count_all_layer_params

train.py:81–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

79# Monkeypatch this so it counts all layer parameters, not just trainable parameters.
80# This helps it divide the layers between GPUs more evenly when training a LoRA.
81def _count_all_layer_params(self):
82 param_counts = [0] * len(self._layer_specs)
83 for idx, layer in enumerate(self._layer_specs):
84 if isinstance(layer, ds_pipe_module.LayerSpec):
85 l = layer.build()
86 param_counts[idx] = sum(p.numel() for p in l.parameters())
87 elif isinstance(layer, nn.Module):
88 param_counts[idx] = sum(p.numel() for p in layer.parameters())
89 return param_counts
90ds_pipe_module.PipelineModule._count_layer_params = _count_all_layer_params
91
92

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected