Skip to content

Commit e7ebfef

Browse files
committed
test: Cover compiled Megatron wrapper names
1 parent 0a7a9ab commit e7ebfef

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/unit/test_megatron_dedicated.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
MergedWeightTransferInitInfo,
1919
)
2020
from art.megatron.service import MegatronService
21+
from art.megatron.train import _unwrap_art_wrapper_name
2122

2223

2324
@pytest.mark.asyncio
@@ -132,6 +133,21 @@ async def fake_create_subprocess_shell(
132133
assert seen["start_new_session"] is True
133134

134135

136+
def test_unwrap_art_wrapper_name_strips_compiled_wrapper_segments() -> None:
137+
assert (
138+
_unwrap_art_wrapper_name(
139+
"module.module.decoder.layers.0._orig_mod.self_attention.linear_proj.linear_proj.weight"
140+
)
141+
== "decoder.layers.0.self_attention.linear_proj.weight"
142+
)
143+
assert (
144+
_unwrap_art_wrapper_name(
145+
"module.module.decoder.layers.0._orig_mod.mlp.experts.linear_fc1.linear_fc1.weight7"
146+
)
147+
== "decoder.layers.0.mlp.experts.linear_fc1.weight7"
148+
)
149+
150+
135151
@pytest.mark.asyncio
136152
async def test_megatron_service_start_openai_server_dedicated_starts_subprocess(
137153
tmp_path: Path,

0 commit comments

Comments
 (0)