-
Notifications
You must be signed in to change notification settings - Fork 1k
[diffusion] add tp support for qwen-image and refactor some tests #830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| if str(REPO_ROOT) not in sys.path: | ||
| sys.path.insert(0, str(REPO_ROOT)) | ||
|
|
||
| from tests.utils import GPUMemoryMonitor | ||
| from vllm_omni import Omni | ||
| from vllm_omni.diffusion.data import DiffusionParallelConfig | ||
| from vllm_omni.outputs import OmniRequestOutput | ||
|
|
@@ -66,7 +67,12 @@ def _extract_single_image(outputs) -> Image.Image: | |
|
|
||
| def _run_zimage_generate( | ||
| *, tp_size: int, height: int, width: int, num_inference_steps: int, seed: int | ||
| ) -> tuple[Image.Image, float]: | ||
| ) -> tuple[Image.Image, float, float]: | ||
| torch.cuda.empty_cache() | ||
| device_index = torch.cuda.current_device() | ||
| monitor = GPUMemoryMonitor(device_index=device_index, interval=0.02) | ||
| monitor.start() | ||
|
Comment on lines
+71
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
|
|
||
| m = Omni( | ||
| model=_get_zimage_model(), | ||
| parallel_config=DiffusionParallelConfig(tensor_parallel_size=tp_size), | ||
|
|
@@ -107,7 +113,10 @@ def _run_zimage_generate( | |
| pass | ||
|
|
||
| median_time_s = float(np.median(per_request_times_s)) | ||
| return _extract_single_image([last_output]), median_time_s | ||
|
|
||
| peak_memory_mb = monitor.peak_used_mb | ||
|
|
||
| return _extract_single_image([last_output]), median_time_s, peak_memory_mb | ||
| finally: | ||
| m.close() | ||
| cleanup_dist_env_and_memory() | ||
|
|
@@ -125,14 +134,14 @@ def test_zimage_tensor_parallel_tp2(tmp_path: Path): | |
| num_inference_steps = 2 | ||
| seed = 42 | ||
|
|
||
| tp1_img, tp1_time_s = _run_zimage_generate( | ||
| tp1_img, tp1_time_s, tp1_peak_mem = _run_zimage_generate( | ||
| tp_size=1, | ||
| height=height, | ||
| width=width, | ||
| num_inference_steps=num_inference_steps, | ||
| seed=seed, | ||
| ) | ||
| tp2_img, tp2_time_s = _run_zimage_generate( | ||
| tp2_img, tp2_time_s, tp2_peak_mem = _run_zimage_generate( | ||
| tp_size=2, | ||
| height=height, | ||
| width=width, | ||
|
|
@@ -164,3 +173,8 @@ def test_zimage_tensor_parallel_tp2(tmp_path: Path): | |
|
|
||
| print(f"Z-Image TP perf (lower is better): tp1_time_s={tp1_time_s:.6f}, tp2_time_s={tp2_time_s:.6f}") | ||
| assert tp2_time_s < tp1_time_s, f"Expected TP=2 to be faster than TP=1 (tp1={tp1_time_s}, tp2={tp2_time_s})" | ||
|
|
||
| print(f"Z-Image TP peak memory (MB): tp1_peak_mem={tp1_peak_mem:.2f}, tp2_peak_mem={tp2_peak_mem:.2f}") | ||
| assert tp2_peak_mem < tp1_peak_mem, ( | ||
| f"Expected TP=2 to use less peak memory than TP=1 (tp1={tp1_peak_mem}, tp2={tp2_peak_mem})" | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.