[MRV2] Support stock torch.compile mode (#59079)
Signed-off-by: cheesecake <farzanaman99@gmail.com> Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
This commit is contained in:
co-authored by
OpenAI Codex
Nick Hill
Wentao Ye
parent
4406874e7c
commit
4e59d53ab5
@@ -56,8 +56,10 @@ class TestSetting:
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("use_v2_model_runner", [False, True])
|
||||
def test_compile_correctness(
|
||||
test_setting: TestSetting,
|
||||
use_v2_model_runner: bool,
|
||||
):
|
||||
model = test_setting.model
|
||||
model_args = test_setting.model_args
|
||||
@@ -75,6 +77,10 @@ def test_compile_correctness(
|
||||
f"--attention-backend={attn_backend}",
|
||||
]
|
||||
|
||||
# Pin every compared setting to the same model runner so that only the
|
||||
# compilation mode differs within a comparison.
|
||||
runner_env = {"VLLM_USE_V2_MODEL_RUNNER": str(int(use_v2_model_runner))}
|
||||
|
||||
all_args: list[list[str]] = []
|
||||
all_envs: list[dict[str, str] | None] = []
|
||||
|
||||
@@ -86,7 +92,7 @@ def test_compile_correctness(
|
||||
CompilationMode.VLLM_COMPILE,
|
||||
]:
|
||||
all_args.append(final_args + [f"-cc.mode={mode.name}", "-cc.backend=inductor"])
|
||||
all_envs.append({})
|
||||
all_envs.append(dict(runner_env))
|
||||
# inductor will change the output, so we only compare if the output
|
||||
# is close, not exactly the same.
|
||||
compare_all_settings(
|
||||
@@ -94,7 +100,6 @@ def test_compile_correctness(
|
||||
all_args,
|
||||
all_envs,
|
||||
method=method if method != "generate" else "generate_close",
|
||||
force_v1_runner=True,
|
||||
)
|
||||
|
||||
all_envs.clear()
|
||||
@@ -108,5 +113,5 @@ def test_compile_correctness(
|
||||
CompilationMode.VLLM_COMPILE,
|
||||
]:
|
||||
all_args.append(final_args + [f"-cc.mode={mode.name}", "-cc.backend=eager"])
|
||||
all_envs.append({})
|
||||
compare_all_settings(model, all_args, all_envs, method=method, force_v1_runner=True)
|
||||
all_envs.append(dict(runner_env))
|
||||
compare_all_settings(model, all_args, all_envs, method=method)
|
||||
|
||||
Reference in New Issue
Block a user