Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 1 deletion inferencex-e2e/docs/video-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ includes the declared settings.

The Python entrypoint validates the workload and GPU identity, prepares an
explicitly selected model view, records the final command, then starts it.
It adds no engine flags or performance environment defaults. The SGLang child
It adds no engine flags or performance environment defaults. For Wan2.2 on
SGLang it also requires `--flow-shift` and the checkpoint's `boundary_ratio` to
equal the plan, because SGLang reads neither from a request. The SGLang child
checks the assigned UUID order before importing its engine. The previous B200
`frozen-c124` four-clip JSON and YAML artifacts remain readable as historical evidence.
The App shows their four-sample cells in History, below its ten-valid-sample chart
Expand Down
11 changes: 8 additions & 3 deletions video-generation/evaluator/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
"negative_prompt",
}
_WAN22_CELL = {"width": 832, "height": 480, "frame_count": 81, "fps": 16}
# SGLang 297e54fd accepts both as request fields, but its Wan pipeline reads the shift from
# --flow-shift and the boundary from the checkpoint's model_index.json, so the launch binds them.
SGLANG_WAN22_SERVER_CONTROLS = ("boundary_ratio", "flow_shift")
# SGLang has no crf field; it encodes with crf = int((1 - output_compression / 100) * 51).
SGLANG_OUTPUT_COMPRESSION = {18: 63}

Expand Down Expand Up @@ -304,10 +307,8 @@ def _slots(plan: dict[str, Any]) -> list[dict[str, Any]]:


def _wan22_payload(plan: dict[str, Any], slot: dict[str, Any], runtime: str) -> dict[str, Any]:
if runtime != "vllm-omni":
raise ValueError("Wan2.2 plans have a vllm-omni request contract only")
generation = plan["generation"]
return {
request = {
"model": plan["model_id"],
"prompt": slot["prompt"],
"seed": slot["seed"],
Expand All @@ -323,6 +324,10 @@ def _wan22_payload(plan: dict[str, Any], slot: dict[str, Any], runtime: str) ->
"negative_prompt": generation["negative_prompt"],
"num_outputs_per_prompt": 1,
}
if runtime == "sglang":
for control in SGLANG_WAN22_SERVER_CONTROLS:
del request[control]
return request
Comment thread
edwingao28 marked this conversation as resolved.
Resolved


def _payload(plan: dict[str, Any], slot: dict[str, Any], runtime: str) -> dict[str, Any]:
Expand Down
25 changes: 24 additions & 1 deletion video-generation/evaluator/srt_selected.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
from infx.bench.video import CREDENTIAL_ENV, cell_dir, read_object, window_file, write_json
from specs import video_spec

from .runner import RUNTIMES, run_plan, validate_plan
from .runner import (
RUNTIMES,
SGLANG_WAN22_SERVER_CONTROLS,
WAN22_MODEL_ID,
run_plan,
validate_plan,
)

RECORDED_ENGINE_ENV = (
"PYTHONPATH",
Expand Down Expand Up @@ -209,6 +215,15 @@ def server_parallelism(runtime: str, argv: list[str]) -> dict:
}


def sglang_wan22_server_controls(model_path: Path, command: list[str]) -> dict:
"""The Wan2.2 controls an SGLang launch would serve, read where SGLang reads them."""
shifts = [value for flag, value in zip(command, command[1:]) if flag == "--flow-shift"]
return {
"flow_shift": float(shifts[0]) if len(shifts) == 1 else None,
"boundary_ratio": read_object(model_path / "model_index.json").get("boundary_ratio"),
}


def serve(
plan: dict,
*,
Expand All @@ -233,6 +248,14 @@ def serve(
snapshot = str(model_path)
if command.count(snapshot) != 1:
raise ValueError("the engine command must contain the model snapshot path exactly once")
if runtime == "sglang" and plan["model_id"] == WAN22_MODEL_ID:
served = sglang_wan22_server_controls(model_path, command)
for control in SGLANG_WAN22_SERVER_CONTROLS:
if served[control] != plan["generation"][control]:
raise ValueError(
f"SGLang would serve {control} {served[control]!r}, "
f"not the plan's {plan['generation'][control]!r}"
)

uuids = gpu_devices()
if len(uuids) != gpus:
Expand Down
2 changes: 1 addition & 1 deletion video-generation/specs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

`h3-v2.yaml` is a separate proposed 5-second H3 workload. Its `release-v1` set contains 20 distinct measured prompts with fixed seeds and a disjoint warmup prompt. The expected delivered clip is 124 frames at 24 fps (124/24 seconds), 1344×768, with 32 kHz stereo audio. The request uses 49 denoising updates; the frozen schedule identity records 50 sigma points and video/audio shifts 12/3.

`wan22.yaml` defines the silent Wan2.2-T2V-A14B text-to-video workload: 832×480, 81 frames at 16 fps, 40 steps, guidance 4.0 for the high-noise expert and 3.0 for the low-noise expert, boundary 0.875, flow shift 12 and an empty negative prompt, all sent per request. `release-v1` crosses four prompts with five seeds (one warmup); `smoke` runs the first case with the same request controls. Only vLLM-Omni has a Wan2.2 request contract.
`wan22.yaml` defines the silent Wan2.2-T2V-A14B text-to-video workload: 832×480, 81 frames at 16 fps, 40 steps, guidance 4.0 for the high-noise expert and 3.0 for the low-noise expert, boundary 0.875, flow shift 12 and an empty negative prompt. vLLM-Omni takes every control per request. SGLang does not read the flow shift or the boundary from a request, so its server refuses to start unless `--flow-shift` and the checkpoint's `model_index.json` `boundary_ratio` equal the spec. `release-v1` crosses four prompts with five seeds (one warmup); `smoke` runs the first case with the same request controls.

`h3.yaml` and `wan22.yaml` use schema version 1 and `h3-v2.yaml` uses schema version 2.
Version 2 adds a `warmup_case` to every set and a `fairness` block that seals the schedule, the requested libx264 ultrafast/CRF 18/yuv420p plus AAC encoding, the disabled cross-request conditioning cache, and the official Diffusers source, model and RNG candidate.
Expand Down
2 changes: 1 addition & 1 deletion video-generation/specs/wan22.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generation:
guidance_scale_2: 3.0
# The A14B expert switch, equal to the checkpoint's model_index.json value.
boundary_ratio: 0.875
# UniPC sigma shift for the 480p cell; every engine must receive it per request.
# UniPC sigma shift for the 480p cell; no engine default may stand in for it.
flow_shift: 12.0
negative_prompt: ""

Expand Down
19 changes: 16 additions & 3 deletions video-generation/tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,22 @@ def test_wan22_requires_every_control():
runner.validate_plan(plan)


def test_wan22_has_no_sglang_request_contract():
with pytest.raises(ValueError, match="vllm-omni"):
runner.preview_plan(wan22_plan(), runtime="sglang")
def test_wan22_sglang_request_omits_only_the_controls_its_server_binds():
plan = wan22_plan()
assert runner.preview_plan(plan, runtime="sglang")["slots"][0]["request"] == {
"model": "Wan-AI/Wan2.2-T2V-A14B-Diffusers",
"prompt": plan["cases"][0]["prompt"],
"seed": 11,
"width": 832,
"height": 480,
"fps": 16,
"num_frames": 81,
"num_inference_steps": 40,
"guidance_scale": 4.0,
"guidance_scale_2": 3.0,
"negative_prompt": "",
"num_outputs_per_prompt": 1,
}


def test_wan22_vllm_omni_run_sends_every_control_and_keeps_server_metrics(
Expand Down
45 changes: 45 additions & 0 deletions video-generation/tests/test_srt_selected.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,51 @@ def test_selected_server_requires_the_recipe_gpus_and_runtime(tmp_path, monkeypa
assert not (tmp_path / "server").exists()


@pytest.mark.parametrize(
("runtime", "flow_shift", "boundary_ratio", "message"),
[
("sglang", "12.0", 0.875, None),
("sglang", "5.0", 0.875, "flow_shift 5.0"),
("sglang", None, 0.875, "flow_shift None"),
("sglang", "12.0", 0.9, "boundary_ratio 0.9"),
("vllm-omni", None, 0.9, None),
],
)
def test_sglang_wan22_launch_must_serve_the_controls_its_requests_omit(
tmp_path, monkeypatch, runtime, flow_shift, boundary_ratio, message
):
plan = video_spec.plan_for(video_spec.load_spec(PACKAGE / "specs/wan22.yaml"), "smoke")
model = tmp_path / "model"
model.mkdir()
(model / "model_index.json").write_text(json.dumps({"boundary_ratio": boundary_ratio}))
monkeypatch.setattr(srt_selected, "cuda_devices", lambda: ["GPU-1"])
monkeypatch.setattr(srt_selected, "KFD", tmp_path / "no-kfd")
executed = []
monkeypatch.setattr(srt_selected.os, "execvpe", lambda file, argv, env: executed.append(argv))
monkeypatch.setenv("VIDEO_CONTAINER_IMAGE", "example/engine:v1@sha256:" + "b" * 64)
command = ["engine", "serve", str(model)] + (["--flow-shift", flow_shift] if flow_shift else [])

def serve():
srt_selected.serve(
plan,
runtime=runtime,
runtime_revision="a" * 40,
model_path=model,
gpus=1,
output=tmp_path / "server",
command=command,
model_view="snapshot",
)

if message is None:
serve()
assert executed == [command]
else:
with pytest.raises(ValueError, match=message):
serve()
assert not executed and not (tmp_path / "server").exists()


@pytest.mark.parametrize(
("field", "value", "message"),
[
Expand Down
Loading