sgl-project/sglang · error · ValueError

Expected scheduler.sigmas to be a tensor for JoyEcho.

Error message

Expected scheduler.sigmas to be a tensor for JoyEcho.

What it means

The JoyEcho step indexes ctx.scheduler.sigmas and requires a torch.Tensor (it calls .to(device=..., dtype=...)). If the configured flow-matching scheduler stores sigmas as a numpy array or other type, the step raises rather than doing implicit conversion.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/denoising.py:463

                "video_memory_prefix_len": memory_video_len if sp_on else 0,
            },
        )

    def _run_denoising_step(
        self,
        ctx: LTX2DenoisingContext,
        step: DenoisingStepState,
        batch: Req,
        server_args: ServerArgs,
    ) -> None:
        if ctx.audio_latents is None:
            raise ValueError("JoyEcho requires audio latents for denoising.")
        if ctx.audio_scheduler is None:
            raise ValueError("JoyEcho audio scheduler was not prepared.")

        sigmas = ctx.scheduler.sigmas
        if not isinstance(sigmas, torch.Tensor):
            raise ValueError("Expected scheduler.sigmas to be a tensor for JoyEcho.")

        sigma = sigmas[step.step_index].to(
            device=ctx.latents.device, dtype=torch.float32
        )
        sigma_next = sigmas[step.step_index + 1].to(
            device=ctx.latents.device, dtype=torch.float32
        )
        sigma_val = float(sigma.item())
        sigma_next_val = float(sigma_next.item())

        model_inputs = self._prepare_ltx2_model_inputs(
            ctx, step, batch, server_args, sigma
        )
        model_inputs, memory_meta = self._build_memory_model_inputs(
            model_inputs, batch, ctx, server_args, step.current_model
        )

        prompt_attention_mask = self._get_ltx_prompt_attention_mask(

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass a scheduler whose sigmas are a torch.Tensor (the default LTX/flow-matching scheduler)
  2. Convert once during preparation: ctx.scheduler.sigmas = torch.as_tensor(sigmas, dtype=torch.float32)
  3. Pin/align sglang and scheduler versions

Example fix

# before
ctx.scheduler.sigmas  # numpy array
# after
import torch
if not isinstance(ctx.scheduler.sigmas, torch.Tensor):
    ctx.scheduler.sigmas = torch.as_tensor(
        ctx.scheduler.sigmas, dtype=torch.float32
    )
Defensive patterns

Strategy: type-guard

Validate before calling

import torch
sig = ctx.scheduler.sigmas
if not isinstance(sig, torch.Tensor):
    ctx.scheduler.sigmas = torch.as_tensor(sig, dtype=torch.float32)

Type guard

def sigmas_are_tensor(ctx) -> bool:
    return isinstance(ctx.scheduler.sigmas, torch.Tensor)

Prevention

When it happens

Trigger: Using a scheduler implementation whose .sigmas property returns a numpy ndarray or list instead of torch.Tensor, then running the JoyEcho denoising step.

Common situations: Swapping in a custom/third-party scheduler; a diffusers-style scheduler whose sigmas are numpy-based; library upgrade changing the sigmas representation.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/ef048b137c1f0ad9. Report an issue: GitHub.