(model)
| 70 | |
| 71 | |
| 72 | def _split_decay_params(model): |
| 73 | decay = [] |
| 74 | no_decay = [] |
| 75 | for name, param in model.named_parameters(): |
| 76 | if param.requires_grad: |
| 77 | if len(param.shape) == 1 or name.endswith(".bias") or "norm" in name: |
| 78 | no_decay.append(param) |
| 79 | else: |
| 80 | decay.append(param) |
| 81 | return decay, no_decay |