Parameter Group

ParameterGroup

class sconce.parameter_group.ParameterGroup(parameters, name, is_active=True)[source]

A parameter group is the way that sconce models organize nn.Module parameters and their associated optimizers.

Parameters:
  • parameters (iterable of torch.nn.Parameter) – the parameters you want to group together.
  • name (string) – your name for this group
  • is_active (bool, optional) – should this group be considered active (used during training)?
freeze()[source]

Set requires_grad = False for all parameters in this group.

set_optimizer(optimizer_class, *args, **kwargs)[source]

Set an optimizer on this parameter group. If this parameter group is active (has is_active=True) then this optimizer will be used during training.

Parameters:optimizer_class (one of the torch.optim classes) – the class of optimizer to set.

Note

All other arguments and keyword arguments are delivered to the optimizer_class’s constructor.

unfreeze()[source]

Set requires_grad = True for all parameters in this group.