Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,12 @@ allowed-unresolved-imports = [
"matplotlib.**",
"seaborn.**",
# megatron deps
"causal_conv1d.**",
"fla.**",
"megatron.**",
"quack.**",
"transformer_engine.**",
"triton.**",
]

[dependency-groups]
Expand Down
41 changes: 41 additions & 0 deletions tests/unit/test_model_support_import_boundary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from pathlib import Path
import subprocess
import sys
import textwrap


def test_get_model_config_qwen3_metadata_does_not_import_megatron() -> None:
subprocess.run(
[
sys.executable,
"-c",
textwrap.dedent(
"""
import builtins
import tempfile

real_import = builtins.__import__

def blocked_import(
name, globals=None, locals=None, fromlist=(), level=0
):
if level == 0 and name.partition(".")[0] == "megatron":
raise ModuleNotFoundError("No module named 'megatron'")
return real_import(name, globals, locals, fromlist, level)

builtins.__import__ = blocked_import

from art.dev.get_model_config import get_model_config

with tempfile.TemporaryDirectory() as tmpdir:
config = get_model_config(
"Qwen/Qwen3-30B-A3B-Instruct-2507",
tmpdir,
None,
)
"""
),
],
cwd=Path(__file__).resolve().parents[2],
check=True,
)
Loading