sgl-project/sglang · error · ValueError
SP DMD renoise requires packed video `batch.raw_latent_shape
Error message
SP DMD renoise requires packed video `batch.raw_latent_shape`.
What it means
In JoyEcho's SP (sequence-parallel) DMD renoise path, when video latents are sharded the sampler reconstructs noise on the full (unsharded) layout using batch.raw_latent_shape. It requires a 3-tuple (frames, height/latent, width/latent) packed video shape; anything else means the batch metadata is missing or malformed.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/denoising.py:207
sigma_t = sigma_t.reshape(-1, *[1] * (original.ndim - 1))
elif sigma_t.ndim == 2:
sigma_t = sigma_t.reshape(*sigma_t.shape, *[1] * (original.ndim - 2))
return (1.0 - sigma_t) * original + sigma_t * noise
def _sample_sp_consistent_noise(
self,
local_reference: torch.Tensor,
batch: Req,
server_args: ServerArgs,
*,
shard_video: bool,
shard_audio: bool,
) -> torch.Tensor:
"""Sample renoise on the global latent layout, then shard for SP."""
if shard_video:
raw_shape = batch.raw_latent_shape
if not (isinstance(raw_shape, tuple) and len(raw_shape) == 3):
raise ValueError(
"SP DMD renoise requires packed video `batch.raw_latent_shape`."
)
full_reference = torch.empty(
tuple(raw_shape),
device=local_reference.device,
dtype=local_reference.dtype,
)
full_noise = self._randn_like_with_batch_generators(full_reference, batch)
sharded_noise, _ = server_args.pipeline_config.shard_latents_for_sp(
batch, full_noise
)
return sharded_noise
if shard_audio:
orig_audio_len = batch.sp_audio_orig_num_frames
if orig_audio_len <= 0:
raise ValueError(
"SP DMD renoise requires `batch.sp_audio_orig_num_frames`."View on GitHub (pinned to 0132848349)
Solutions
- Ensure the upstream stage sets batch.raw_latent_shape to the packed 3-tuple (C*T? no: frames, h_lat, w_lat) of the full unsharded video latent
- Disable sharding (shard_video=False) if running single-GPU
- Upgrade/align the stage that constructs the batch so SP metadata is populated
Example fix
# before batch.raw_latent_shape = None # or tuple(latents.shape) # 4-D # after batch.raw_latent_shape = (num_latent_frames, h_lat, w_lat) # packed 3-tuple
Defensive patterns
Strategy: type-guard
Validate before calling
if shard_video and not (isinstance(getattr(batch, 'raw_latent_shape', None), tuple) and len(batch.raw_latent_shape) == 3):
raise/shard_video = False # or populate the field upstream Type guard
def has_packed_video_shape(b) -> bool:
s = getattr(b, 'raw_latent_shape', None)
return isinstance(s, tuple) and len(s) == 3 Prevention
- Always set raw_latent_shape when building batches for SP runs
- Add an integration test that exercises the SP path end to end
When it happens
Trigger: Running DMD denoising with shard_video=True but batch.raw_latent_shape unset, None, a list, or not length 3 (e.g. a 4-D tensor shape was stored instead of the packed 3-D latent shape).
Common situations: Building Req batches manually without the SP metadata; a pipeline change that stopped populating raw_latent_shape when sequence parallelism is enabled; enabling shard_video on a video path that never packed latents.
Related errors
- SP DMD renoise requires `batch.sp_audio_orig_num_frames`.
- MiniMax H3 Ulysses size must be positive.
- MiniMax H3 ring size must be positive.
- latent_window_size must be positive, got {latent_window_size
- v_cache must be provided
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/ba987a31cb18487c.
Report an issue: GitHub.