File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,12 +195,14 @@ def inject_lora(root: nn.Module, cfg: LoRAConfig) -> None:
195195
196196 inject_lora(model.embedding, cfg)
197197 """
198+ matched_count = 0
198199 wrapped_count = 0
199200
200201 for name , module in list (root .named_modules ()):
201202 if not _name_matches (name , cfg .target_patterns ):
202203 continue
203204
205+ matched_count += 1
204206 parent = _get_parent (root , name )
205207 child_name = name .split ("." )[- 1 ]
206208 wrapped = None
@@ -240,7 +242,7 @@ def inject_lora(root: nn.Module, cfg: LoRAConfig) -> None:
240242
241243 logger .info ("[LoRA] Wrapped %d modules (rank=%d)" , wrapped_count , cfg .rank )
242244
243- if wrapped_count == 0 :
245+ if matched_count == 0 :
244246 raise RuntimeError (
245247 "No modules matched LoRA target patterns. "
246248 "Verify module names with: list(model.named_modules())."
You can’t perform that action at this time.
0 commit comments