[diffusion] chore: further refine output resolution adjustment logic (#14558)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot]
parent
7871593cc8
commit
80cfca50bc
@@ -8,9 +8,6 @@ from sglang.multimodal_gen.configs.sample.sampling_params import SamplingParams
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class FluxSamplingParams(SamplingParams):
|
class FluxSamplingParams(SamplingParams):
|
||||||
# Video parameters
|
|
||||||
# height: int = 1024
|
|
||||||
# width: int = 1024
|
|
||||||
num_frames: int = 1
|
num_frames: int = 1
|
||||||
# Denoising stage
|
# Denoising stage
|
||||||
guidance_scale: float = 1.0
|
guidance_scale: float = 1.0
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ from sglang.multimodal_gen.configs.sample.sampling_params import SamplingParams
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class QwenImageSamplingParams(SamplingParams):
|
class QwenImageSamplingParams(SamplingParams):
|
||||||
# Video parameters
|
|
||||||
# height: int = 1024
|
|
||||||
# width: int = 1024
|
|
||||||
negative_prompt: str = " "
|
negative_prompt: str = " "
|
||||||
num_frames: int = 1
|
num_frames: int = 1
|
||||||
# Denoising stage
|
# Denoising stage
|
||||||
|
|||||||
@@ -192,10 +192,8 @@ class SamplingParams:
|
|||||||
|
|
||||||
if self.width is None:
|
if self.width is None:
|
||||||
self.width_not_provided = True
|
self.width_not_provided = True
|
||||||
self.width = 1280
|
|
||||||
if self.height is None:
|
if self.height is None:
|
||||||
self.height_not_provided = True
|
self.height_not_provided = True
|
||||||
self.height = 720
|
|
||||||
|
|
||||||
def check_sampling_param(self):
|
def check_sampling_param(self):
|
||||||
if self.prompt_path and not self.prompt_path.endswith(".txt"):
|
if self.prompt_path and not self.prompt_path.endswith(".txt"):
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ def prepare_request(
|
|||||||
req = Req(**filtered_params, VSA_sparsity=server_args.VSA_sparsity)
|
req = Req(**filtered_params, VSA_sparsity=server_args.VSA_sparsity)
|
||||||
req.adjust_size(server_args)
|
req.adjust_size(server_args)
|
||||||
|
|
||||||
if req.width <= 0 or req.height <= 0:
|
if (req.width is not None and req.width <= 0) or (
|
||||||
|
req.height is not None and req.height <= 0
|
||||||
|
):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Height, width must be positive integers, got "
|
f"Height, width must be positive integers, got "
|
||||||
f"height={req.height}, width={req.width}"
|
f"height={req.height}, width={req.width}"
|
||||||
|
|||||||
@@ -219,9 +219,7 @@ class Req:
|
|||||||
self.guidance_scale_2 = self.guidance_scale
|
self.guidance_scale_2 = self.guidance_scale
|
||||||
|
|
||||||
def adjust_size(self, server_args: ServerArgs):
|
def adjust_size(self, server_args: ServerArgs):
|
||||||
if self.height is None or self.width is None:
|
pass
|
||||||
self.width = 1280
|
|
||||||
self.height = 720
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return pprint.pformat(asdict(self), indent=2, width=120)
|
return pprint.pformat(asdict(self), indent=2, width=120)
|
||||||
|
|||||||
Reference in New Issue
Block a user