Train partial layers of a given model.
(model, partial_list)
| 67 | return model |
| 68 | |
| 69 | def partial_train_layers(model, partial_list): |
| 70 | """Train partial layers of a given model.""" |
| 71 | for name, p in model.named_parameters(): |
| 72 | p.requires_grad = False |
| 73 | for trainable in partial_list: |
| 74 | if trainable in name: |
| 75 | p.requires_grad = True |
| 76 | break |
| 77 | return model |
| 78 | |
| 79 | def load_backbone(args): |
| 80 | if not(hasattr(args, "backbone")): |
no outgoing calls
no test coverage detected