From 4e702886e5843ad8bcb0f226340e2587528b0512 Mon Sep 17 00:00:00 2001 From: dohe0342 Date: Thu, 25 May 2023 19:38:59 +0900 Subject: [PATCH] from local --- .../.train_lora.py.swp | Bin 86016 -> 86016 bytes .../train_lora.py | 23 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/.train_lora.py.swp b/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/.train_lora.py.swp index 0b4a6064cfaba717eb3a07a1f961cd9cce31a403..bc626fd43a4fb12e3ffebcccff2e301462924860 100644 GIT binary patch delta 578 zcmXBQPe_w-7{Kx8(cXMlbG;Mil3`@C1|pW#Vc@$BCDR1)q8Zv0LIf=+hz@}={~U~{ zgL?Q8K`n?xF+)1M(4q1qB6=w7kVM@?qNGNbWYAZ7;PdcYovOns~Jde7^+ZN}@h%na0P%IqXGX^y!XFb%HO%{=&0 rZ5Ca%O~NMqNa%85EEY3!No_HwDzwU!ru2eF&6Si+YSjCh(n{wa%^zq& delta 545 zcmYk(PbkB27{~GFyY|Bvev?sav|7T!nvxu34$>@K6bB~%E{kxID4SAT*VM0+wu93W zvG|n(xhe;g9LS#oH?5Ql;%zQI_4@W4zCGWk?-NUDv6SW<^Y?f4cv^goLUfVVmYIo> zJ?Do*4P_i&4YJ4-?4UVyoG@^Ei$~1)s zpG922CKfP-All)E!hNC03F25q9cuAn6M4cOwy}jcI?;-3fygD6;YS^6@thxJl6;YA zM9>B&%5j}1a)Au?v4RjfPyq`*G?90_;udGv#Rk?ehe?cM3?AI^+gnIt*vb($NC;-)s)+-nGGmi{{i}~V#NRe diff --git a/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/train_lora.py b/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/train_lora.py index 125d79fbf..aa9197980 100755 --- a/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/train_lora.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless_d2v_v2/train_lora.py @@ -1607,27 +1607,30 @@ def run_adapter(rank, world_size, args, wb=None): lora_modules = [] for modules in model.modules(): if isinstance(modules, fairseq.modules.multihead_attention.MultiheadAttention): - #lora_modules.append(LoRAHook(modules)) - for module in modules.modules(): + lora_modules.append(LoRAHook(modules)) + #for module in modules.modules(): # if rank == 0: logging.info(module) #print(module) - if isinstance(module, torch.nn.Linear): + #if isinstance(module, torch.nn.Linear): #if rank == 0: print(module) - lora_modules.append(LoRAHook(module)) + #lora_modules.append(LoRAHook(module)) adapter_names = [] adapter_param = [] + ''' for i, lora in enumerate(lora_modules): for n, p in lora.lora.named_parameters(): new_n = str(i) + n adapter_names.append(new_n) adapter_param.append(p) - - #for n, p in model.named_parameters(): - #if 'joiner' in n or 'simple' in n or 'ctc' in n: - # p.requires_grad = True - #else: - # p.requires_grad = False + ''' + for n, p in model.named_parameters(): + if 'joiner' in n or 'simple' in n or 'ctc' in n: + adapter_names.append(n) + adapter_param.append(p) + p.requires_grad = True + else: + p.requires_grad = False #for lora in lora_modules: # print(lora.lora.state_dict())