MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / get_params_groups

Function get_params_groups

utils.py:612–623  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

610
611
612def get_params_groups(model):
613 regularized = []
614 not_regularized = []
615 for name, param in model.named_parameters():
616 if not param.requires_grad:
617 continue
618 # we do not regularize biases nor Norm parameters
619 if name.endswith(".bias") or len(param.shape) == 1:
620 not_regularized.append(param)
621 else:
622 regularized.append(param)
623 return [{'params': regularized}, {'params': not_regularized, 'weight_decay': 0.}]
624
625
626def has_batchnorms(model):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected