[Bug Fix] Resolve broken image issue when TP is enabled and no seed is provided. (#2176)
Signed-off-by: Mike Cheung <zhtmike@gmail.com>
This commit is contained in:
1 parent
66d5478dad
commit
590ab5b3e9
2 files changed
+36
No files matched your search
@@ -2,6 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
import random
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniPromptType
|
||||
@@ -28,6 +29,11 @@ class OmniDiffusionRequest:
|
||||
|
||||
def __post_init__(self):
|
||||
"""Initialize dependent fields after dataclass initialization."""
|
||||
# When neither a generator nor a seed is provided, assign a random seed
|
||||
# so that all ranks derive the same generator state.
|
||||
if self.sampling_params.generator is None and self.sampling_params.seed is None:
|
||||
self.sampling_params.seed = random.randint(0, 2**31 - 1)
|
||||
|
||||
# Detect whether user explicitly provided guidance_scale.
|
||||
# The sentinel default is 0.0 (false-like); any truthy value means
|
||||
# the caller set it intentionally. We must resolve this BEFORE
|
||||
|
||||
Reference in new issue
Block a user