(target_module, new_weight)
| 45 | |
| 46 | |
| 47 | def replace_module_weights(target_module, new_weight): |
| 48 | device = target_module.weight.device |
| 49 | target_module.weight = torch.nn.Parameter(new_weight) |
| 50 | |
| 51 | # dispatch to correct device |
| 52 | for name, module in target_module.named_modules(): |
| 53 | if "lora_" in name: |
| 54 | module.to(device) |
| 55 | |
| 56 | |
| 57 | def update_decoder_weights(target_module, new_weight): |
no outgoing calls
no test coverage detected