wip refactor

This commit is contained in:
2024-03-13 19:45:52 +01:00
parent 11ea9eeaa7
commit 5acb6809ed
5 changed files with 292 additions and 232 deletions

7
utils.py Normal file
View File

@ -0,0 +1,7 @@
from peft.utils import _get_submodules
import torch
def replace_module(model, key: str, module: torch.nn.Module):
parent, target, target_name = _get_submodules(model, key)
setattr(parent, target_name, module)