Compare commits

..

2 Commits

Author SHA1 Message Date
yanghw116 a1bf1240f9
Merge efd8073450 into 4a68da72d5 2026-05-31 13:39:25 +08:00
jingyaogong 4a68da72d5 [fix] lora dims 2026-05-31 13:38:51 +08:00
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ class LoRA(nn.Module):
def apply_lora(model, rank=16):
for name, module in model.named_modules():
if isinstance(module, nn.Linear) and module.weight.shape[0] == module.weight.shape[1]:
lora = LoRA(module.weight.shape[0], module.weight.shape[1], rank=rank).to(model.device)
if isinstance(module, nn.Linear) and module.in_features == module.out_features:
lora = LoRA(module.in_features, module.out_features, rank=rank).to(model.device)
setattr(module, "lora", lora)
original_forward = module.forward