Skip to content

Commit a7ed09f

Browse files
committed
match merge
Signed-off-by: Kyle Sayers <[email protected]>
1 parent b7f61b9 commit a7ed09f

File tree

2 files changed

+428
-3
lines changed

2 files changed

+428
-3
lines changed

src/compressed_tensors/utils/match.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import logging
1616
import re
17-
from collections import OrderedDict
1817
from collections.abc import Generator
1918
from typing import Iterable, Tuple
2019

@@ -153,7 +152,7 @@ def match_modules_set(
153152
matches[target] = module
154153

155154
# once we have a full set, yield and reset
156-
if all(matches[target] is not None for target in targets):
155+
if targets and all((matches[target] is not None for target in targets)):
157156
yield [matches[target] for target in targets] # ensure correct ordering
158157
matches = dict.fromkeys(targets, None)
159158

@@ -176,7 +175,7 @@ def match_name(name: str, target: str) -> bool:
176175
regex matches or if target string exactly matches name
177176
"""
178177
if target.startswith("re:"):
179-
return re.match(target.removeprefix("re:"), name)
178+
return re.match(target.removeprefix("re:"), name) is not None
180179
else:
181180
return target == name
182181

0 commit comments

Comments
 (0)