Skip to content

Commit f3d9f10

Browse files
test updates
Signed-off-by: Brian Dellabetta <bdellabe@redhat.com>
1 parent db1f09e commit f3d9f10

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/llmcompressor/modifiers/awq/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,9 @@ def get_lowest_common_parent(names: List[str], module: Module) -> Tuple[str, Mod
767767
parent_name = s1[:i].rstrip(".")
768768
break
769769

770-
while parent_name != "":
770+
while True:
771+
if parent_name == "":
772+
return "", module
771773
parent = get_layer_by_name(parent_name, module)
772774
if not isinstance(parent, torch.nn.ModuleList):
773775
return parent_name, parent

tests/llmcompressor/modifiers/awq/test_base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,13 @@ def test_get_lowest_common_parent():
202202
)
203203
model = torch.nn.ModuleDict(
204204
{
205+
"embed_tokens": torch.nn.Linear(4, 2),
205206
"decoder": torch.nn.ModuleDict(
206207
{
207208
"self_attn": self_attn,
208209
"mlp": mlp,
209210
}
210-
)
211+
),
211212
}
212213
)
213214

@@ -225,3 +226,8 @@ def test_get_lowest_common_parent():
225226
["decoder.mlp.experts.1.gate_proj", "decoder.self_attn.v_proj"], model
226227
)
227228
assert parent_name == "decoder" and parent == model["decoder"]
229+
230+
parent_name, parent = get_lowest_common_parent(
231+
["embed_tokens", "decoder.self_attn.v_proj"], model
232+
)
233+
assert parent_name == "" and parent == model

0 commit comments

Comments
 (0)