[NPU] [Diffusion] Fix NPU multimodal-gen CI (#41528)
This commit is contained in:
@@ -17,6 +17,7 @@ import pickle
|
||||
import queue
|
||||
import threading
|
||||
import time
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import numpy as np
|
||||
@@ -177,20 +178,16 @@ def _is_tensor_like(value) -> bool:
|
||||
|
||||
|
||||
def _to_json_serializable(value):
|
||||
if isinstance(value, Enum):
|
||||
return value.name
|
||||
if isinstance(value, (torch.Tensor, np.ndarray)):
|
||||
return value.tolist()
|
||||
if isinstance(value, np.generic):
|
||||
return value.item()
|
||||
if isinstance(value, dict):
|
||||
return {key: _to_json_serializable(item) for key, item in value.items()}
|
||||
if isinstance(value, (list, tuple)):
|
||||
converted = []
|
||||
for item in value:
|
||||
if isinstance(item, (torch.Tensor, np.ndarray)):
|
||||
converted.append(item.tolist())
|
||||
elif isinstance(item, np.generic):
|
||||
converted.append(item.item())
|
||||
else:
|
||||
converted.append(item)
|
||||
return converted
|
||||
return [_to_json_serializable(item) for item in value]
|
||||
return value
|
||||
|
||||
|
||||
|
||||
+1
@@ -286,6 +286,7 @@ class MiniMaxH3TextEncodingStage(TextEncodingStage):
|
||||
raise ValueError(
|
||||
"MiniMaxH3TextEncodingStage direct encode requires a tokenizer component"
|
||||
)
|
||||
self._begin_text_encoder_use(0)
|
||||
with set_forward_context(current_timestep=0, attn_metadata=None):
|
||||
if plan.task == "ref2va":
|
||||
embeddings = self._encode_ref2va(
|
||||
|
||||
@@ -708,7 +708,7 @@
|
||||
"stages_ms": {
|
||||
"InputValidationStage": 0.1,
|
||||
"MiniMaxH3PartitionAdmissionStage": 0.06,
|
||||
"MiniMaxH3TextEncodingStage": 134.59,
|
||||
"MiniMaxH3TextEncodingStage": 421.11,
|
||||
"MiniMaxH3VisualEncodingStage": 0.06,
|
||||
"MiniMaxH3AudioEncodingStage": 0.11,
|
||||
"MiniMaxH3LatentPreparationStage": 41.31,
|
||||
|
||||
@@ -45,7 +45,7 @@ SGL_TEST_FILES_CI_DATA_REVISION = "dbb70135da54b1f2b172886b28e813d2bcdd16c1"
|
||||
# The NPU pin is kept as a separate branch so ascend GT can be bumped independently
|
||||
# when it's regenerated on its own cadence.
|
||||
if current_platform.is_npu():
|
||||
SGL_TEST_FILES_CI_DATA_REVISION = "cbeaa640573a4bb08dc1c41af92221bfae51b7f6"
|
||||
SGL_TEST_FILES_CI_DATA_REVISION = "609c4cef31864d75dbd11fe3c26b8ae09469204d"
|
||||
|
||||
SGL_TEST_FILES_CONSISTENCY_GT_ROOT = (
|
||||
"https://raw.githubusercontent.com/"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from sglang.multimodal_gen.configs.sample.sampling_params import SamplingParams
|
||||
from sglang.multimodal_gen.configs.task_type import ModelTaskType
|
||||
from sglang.multimodal_gen.runtime.disaggregation.roles import (
|
||||
RoleType,
|
||||
filter_modules_for_role,
|
||||
@@ -20,6 +22,22 @@ from sglang.multimodal_gen.runtime.pipelines.qwen_image21 import QwenImage21Pipe
|
||||
from sglang.multimodal_gen.runtime.pipelines_core import Req
|
||||
|
||||
|
||||
def test_task_type_survives_disagg_transfer():
|
||||
"""A GLM request must cross the JSON transport after AR completes."""
|
||||
req = Req(
|
||||
request_id="glm-transfer",
|
||||
prompt="test",
|
||||
sampling_params=SamplingParams(task_type=ModelTaskType.TI2I),
|
||||
)
|
||||
|
||||
tensors, scalars = extract_transfer_fields(req)
|
||||
metadata, buffers = pack_tensors(tensors, scalars)
|
||||
received, scalars = unpack_tensors([metadata, *[w._view for w in buffers]])
|
||||
rebuilt = SchedulerDisaggMixin._build_disagg_req(None, scalars, received)
|
||||
|
||||
assert ModelTaskType.parse(rebuilt.task_type) == ModelTaskType.TI2I
|
||||
|
||||
|
||||
def test_qwen21_disagg_encoder_loads_condition_vae():
|
||||
pipeline = object.__new__(QwenImage21Pipeline)
|
||||
modules = filter_modules_for_role(
|
||||
|
||||
Reference in New Issue
Block a user