Skip to content

Commit 9164339

Browse files
committed
enforce include_patterns as strict whitelist
1 parent c94c173 commit 9164339

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/musubi_tuner/networks/lora.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ def __init__(
483483
exclude_re_patterns.append(re_pattern)
484484

485485
include_re_patterns = []
486+
has_include_filter = include_patterns is not None
486487
if include_patterns is not None:
487488
for pattern in include_patterns:
488489
try:
@@ -523,7 +524,7 @@ def create_modules(
523524
if pattern.fullmatch(original_name):
524525
excluded = True
525526
break
526-
included = False
527+
included = not has_include_filter
527528
for pattern in include_re_patterns:
528529
if pattern.fullmatch(original_name):
529530
included = True
@@ -532,6 +533,10 @@ def create_modules(
532533
if verbose:
533534
logger.info(f"exclude: {original_name}")
534535
continue
536+
if has_include_filter and not included:
537+
if verbose:
538+
logger.info(f"not included: {original_name}")
539+
continue
535540

536541
# filter by name (not used in the current implementation)
537542
if filter is not None and filter not in lora_name:

0 commit comments

Comments
 (0)