31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
|
|
import random
|
|
|
|
import pytest
|
|
|
|
from vllm_omni.diffusion.request import OmniDiffusionRequest
|
|
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
|
|
|
|
pytestmark = [pytest.mark.core_model, pytest.mark.diffusion, pytest.mark.cpu]
|
|
|
|
|
|
def _make_request() -> OmniDiffusionRequest:
|
|
return OmniDiffusionRequest(
|
|
prompts=[{"prompt": "a cup of coffee on a table"}],
|
|
sampling_params=OmniDiffusionSamplingParams(num_inference_steps=1),
|
|
)
|
|
|
|
|
|
def test_tp_seed_same_across_ranks_and_varies_across_requests():
|
|
random.seed(0)
|
|
n_requests = 5
|
|
seeds = [_make_request().sampling_params.seed for _ in range(n_requests)]
|
|
|
|
# Seed must be auto-assigned (not None) so every TP rank can use it.
|
|
assert all(s is not None for s in seeds)
|
|
|
|
# Seeds must vary across requests (non-determinism preserved).
|
|
assert len(set(seeds)) == n_requests, f"Expected {n_requests} unique seeds but got {len(set(seeds))}: {seeds}"
|