(model)
| 132 | |
| 133 | |
| 134 | def only_optimize_lora_parameters(model): |
| 135 | # turn off the gradient of all the parameters except the LoRA parameters |
| 136 | for name, param in model.named_parameters(): |
| 137 | if "lora_right_weight" in name or "lora_left_weight" in name: |
| 138 | param.requires_grad = True |
| 139 | else: |
| 140 | param.requires_grad = False |
| 141 | return model |
nothing calls this directly
no outgoing calls
no test coverage detected