[Diffusion][HunyuanImage3] Add request paged prefix caching (#7719)
Signed-off-by: zwhzzz0821 <2831474076@qq.com>
This commit is contained in:
1 parent
9a1a05facd
commit
205aa01c7b
49 files changed
+2889
-127
No files matched your search
@@ -0,0 +1,131 @@
|
||||
[
|
||||
{
|
||||
"test_name": "test_hunyuan_image3_prefix_dense",
|
||||
"mark": [{"hardware_marks": {"res": {"cuda": "H100"}, "num_cards": 4}}, "diffusion", "local_model"],
|
||||
"description": "Repeated two-image IT2I request on a single DiT stage: dense baseline (TP4, CFGP1)",
|
||||
"server_params": {
|
||||
"model": "tencent/HunyuanImage-3.0-Instruct",
|
||||
"serve_args": {
|
||||
"trust-remote-code": true,
|
||||
"deploy-config": "vllm_omni/deploy/hunyuan_image3_dit.yaml"
|
||||
},
|
||||
"stage_overrides": {
|
||||
"0": {
|
||||
"max_model_len": 22800,
|
||||
"max_num_batched_tokens": 32768,
|
||||
"diffusion_kv_mode": "dense_legacy",
|
||||
"diffusion_kv_max_rows_per_request": 2,
|
||||
"enable_prefix_caching": false,
|
||||
"vae_use_tiling": true,
|
||||
"parallel_config": {"vae_patch_parallel_size": 4}
|
||||
}
|
||||
}
|
||||
},
|
||||
"benchmark_params": [{
|
||||
"dataset_name": "custom_image",
|
||||
"dataset_path": "tests/assets/hunyuan_image3/it2i.jsonl",
|
||||
"endpoint": "/v1/images/edits",
|
||||
"skip_tokenizer_init": true,
|
||||
"disable_shuffle": true,
|
||||
"num_prompts": 8,
|
||||
"max_concurrency": 1,
|
||||
"num_warmups": 2,
|
||||
"seed": 42,
|
||||
"percentile_metrics": "e2el",
|
||||
"extra_body": {
|
||||
"guidance_scale": 2.5,
|
||||
"sys_type": "en_unified",
|
||||
"seed": 42,
|
||||
"size": "1280x720",
|
||||
"num_inference_steps": 8,
|
||||
"bot_task": "think_recaption"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"test_name": "test_hunyuan_image3_prefix_paged_no_cache",
|
||||
"mark": [{"hardware_marks": {"res": {"cuda": "H100"}, "num_cards": 4}}, "diffusion", "local_model"],
|
||||
"description": "Repeated two-image IT2I request on a single DiT stage: paged without prefix caching (TP4, CFGP1)",
|
||||
"server_params": {
|
||||
"model": "tencent/HunyuanImage-3.0-Instruct",
|
||||
"serve_args": {
|
||||
"trust-remote-code": true,
|
||||
"deploy-config": "vllm_omni/deploy/hunyuan_image3_dit.yaml"
|
||||
},
|
||||
"stage_overrides": {
|
||||
"0": {
|
||||
"max_model_len": 22800,
|
||||
"max_num_batched_tokens": 32768,
|
||||
"diffusion_kv_mode": "paged_scheduler",
|
||||
"diffusion_kv_max_rows_per_request": 2,
|
||||
"enable_prefix_caching": false,
|
||||
"vae_use_tiling": true,
|
||||
"parallel_config": {"vae_patch_parallel_size": 4}
|
||||
}
|
||||
}
|
||||
},
|
||||
"benchmark_params": [{
|
||||
"dataset_name": "custom_image",
|
||||
"dataset_path": "tests/assets/hunyuan_image3/it2i.jsonl",
|
||||
"endpoint": "/v1/images/edits",
|
||||
"skip_tokenizer_init": true,
|
||||
"disable_shuffle": true,
|
||||
"num_prompts": 8,
|
||||
"max_concurrency": 1,
|
||||
"num_warmups": 2,
|
||||
"seed": 42,
|
||||
"percentile_metrics": "e2el",
|
||||
"extra_body": {
|
||||
"guidance_scale": 2.5,
|
||||
"sys_type": "en_unified",
|
||||
"seed": 42,
|
||||
"size": "1280x720",
|
||||
"num_inference_steps": 8,
|
||||
"bot_task": "think_recaption"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"test_name": "test_hunyuan_image3_prefix_paged_prefix",
|
||||
"mark": [{"hardware_marks": {"res": {"cuda": "H100"}, "num_cards": 4}}, "diffusion", "local_model"],
|
||||
"description": "Repeated two-image IT2I request on a single DiT stage: paged with full prefix reuse (TP4, CFGP1)",
|
||||
"server_params": {
|
||||
"model": "tencent/HunyuanImage-3.0-Instruct",
|
||||
"serve_args": {
|
||||
"trust-remote-code": true,
|
||||
"deploy-config": "vllm_omni/deploy/hunyuan_image3_dit.yaml"
|
||||
},
|
||||
"stage_overrides": {
|
||||
"0": {
|
||||
"max_model_len": 22800,
|
||||
"max_num_batched_tokens": 32768,
|
||||
"diffusion_kv_mode": "paged_scheduler",
|
||||
"diffusion_kv_max_rows_per_request": 2,
|
||||
"enable_prefix_caching": true,
|
||||
"vae_use_tiling": true,
|
||||
"parallel_config": {"vae_patch_parallel_size": 4}
|
||||
}
|
||||
}
|
||||
},
|
||||
"benchmark_params": [{
|
||||
"dataset_name": "custom_image",
|
||||
"dataset_path": "tests/assets/hunyuan_image3/it2i.jsonl",
|
||||
"endpoint": "/v1/images/edits",
|
||||
"skip_tokenizer_init": true,
|
||||
"disable_shuffle": true,
|
||||
"num_prompts": 8,
|
||||
"max_concurrency": 1,
|
||||
"num_warmups": 2,
|
||||
"seed": 42,
|
||||
"percentile_metrics": "e2el",
|
||||
"extra_body": {
|
||||
"guidance_scale": 2.5,
|
||||
"sys_type": "en_unified",
|
||||
"seed": 42,
|
||||
"size": "1280x720",
|
||||
"num_inference_steps": 8,
|
||||
"bot_task": "think_recaption"
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -254,6 +254,38 @@ def test_merge_omni_default_server_args_respects_json():
|
||||
]
|
||||
|
||||
|
||||
def test_prefix_benchmark_uses_unified_runner(monkeypatch):
|
||||
from pathlib import Path
|
||||
|
||||
from tests.dfx.conftest import is_diffusion_perf_config, load_benchmark_configs
|
||||
from tests.dfx.perf.scripts import run_benchmark
|
||||
|
||||
configs = load_benchmark_configs(str(Path(__file__).with_name("test_hunyuan_image3_prefix_caching.json")))
|
||||
assert len(configs) == 3
|
||||
assert all(not is_diffusion_perf_config(config) for config in configs)
|
||||
assert all(config["benchmark_params"] == configs[0]["benchmark_params"] for config in configs)
|
||||
monkeypatch.setattr(run_benchmark, "BENCHMARK_CONFIGS", configs)
|
||||
monkeypatch.setattr(run_benchmark, "get_runtime_resource_label", lambda: "H100")
|
||||
calls = []
|
||||
|
||||
def benchmark(**kwargs):
|
||||
calls.append(kwargs)
|
||||
assert "--name" not in kwargs["args"]
|
||||
assert "--warmup-dataset-path" not in kwargs["args"]
|
||||
assert "tests/assets/hunyuan_image3/it2i.jsonl" in kwargs["args"]
|
||||
assert kwargs["num_warmups"] == 2
|
||||
return {"completed": 8}
|
||||
|
||||
monkeypatch.setattr(run_benchmark, "run_benchmark", benchmark)
|
||||
for config in configs:
|
||||
for params in config["benchmark_params"]:
|
||||
run_benchmark.test_performance_benchmark(
|
||||
SimpleNamespace(host="localhost", port=8000, model="test-model"),
|
||||
{"test_name": config["test_name"], "params": params},
|
||||
)
|
||||
assert len(calls) == 3
|
||||
|
||||
|
||||
def test_benchmark_param_id_suffix_from_task_eval_phase():
|
||||
from tests.dfx.conftest import _unique_benchmark_param_id_suffixes
|
||||
|
||||
|
||||
Reference in new issue
Block a user