MCPcopy Create free account
hub / github.com/CERT-Lab/lora-sb / update_decoder_weights

Function update_decoder_weights

utils/initialization_utils.py:57–65  ·  view source on GitHub ↗
(target_module, new_weight)

Source from the content-addressed store, hash-verified

55
56
57def update_decoder_weights(target_module, new_weight):
58 device = target_module.weight.device
59 with torch.no_grad():
60 target_module.weight.copy_(new_weight)
61
62 # dispatch to correct device
63 for name, module in target_module.named_modules():
64 if "lora_" in name:
65 module.to(device)
66
67
68def kaiming_uniform_init_lower_half(matrix: torch.tensor):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected