[Diffusion] switch to local calculate_dimensions (#13294)

This commit is contained in:
Adarsh Shirawalmath
2025-11-15 11:25:13 +05:30
committed by GitHub
parent 10285ec204
commit c2083116e3
3 changed files with 12 additions and 3 deletions

View File

@@ -3,9 +3,8 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass, field
from diffusers.pipelines.qwenimage.pipeline_qwenimage_edit import calculate_dimensions
from sglang.multimodal_gen.configs.models.vaes.base import VAEArchConfig, VAEConfig
from sglang.multimodal_gen.utils import calculate_dimensions
@dataclass

View File

@@ -4,13 +4,13 @@ from dataclasses import dataclass, field
from typing import Callable
import torch
from diffusers.pipelines.qwenimage.pipeline_qwenimage_edit import calculate_dimensions
from sglang.multimodal_gen.configs.models import DiTConfig, EncoderConfig, VAEConfig
from sglang.multimodal_gen.configs.models.dits.qwenimage import QwenImageDitConfig
from sglang.multimodal_gen.configs.models.encoders.qwen_image import Qwen2_5VLConfig
from sglang.multimodal_gen.configs.models.vaes.qwenimage import QwenImageVAEConfig
from sglang.multimodal_gen.configs.pipelines.base import ModelTaskType, PipelineConfig
from sglang.multimodal_gen.utils import calculate_dimensions
def _extract_masked_hidden(hidden_states: torch.Tensor, mask: torch.Tensor):

View File

@@ -801,3 +801,13 @@ def save_decoded_latents_as_video(
os.makedirs(os.path.dirname(output_path), exist_ok=True)
imageio.mimsave(output_path, frames, fps=fps, format="mp4")
def calculate_dimensions(target_area, ratio):
width = math.sqrt(target_area * ratio)
height = width / ratio
width = round(width / 32) * 32
height = round(height / 32) * 32
return width, height, None