sgl-project/sglang · error · ValueError
SANA-WM streaming requires positive prompt embeds.
Error message
SANA-WM streaming requires positive prompt embeds.
What it means
_resolve_stream_conditioning requires positive prompt embeds (pcfg.get_pos_prompt_embeds(batch)) for every streaming forward. If the text-encoding stage did not populate them, text conditioning is impossible and the stage raises immediately.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py:465
# is for the dense path; using it here ran CFG=4.5 vs the reference's none.
cfg_scale = sampler_cfg.streaming_cfg_scale
do_cfg = bool(batch.do_classifier_free_guidance) and cfg_scale > 1.0
if server_args.enable_cfg_parallel and do_cfg:
raise NotImplementedError(
"SANA-WM streaming does not support CFG parallel; run replicated."
)
# --- text conditioning ---
pos_embeds = _to_device_dtype(
_first_tensor(pcfg.get_pos_prompt_embeds(batch)),
device=device,
dtype=target_dtype,
)
pos_mask = _to_device_dtype(
_first_tensor(batch.prompt_attention_mask), device=device
)
if pos_embeds is None:
raise ValueError("SANA-WM streaming requires positive prompt embeds.")
neg_embeds = neg_mask = None
if do_cfg:
neg_embeds = _to_device_dtype(
_first_tensor(pcfg.get_neg_prompt_embeds(batch)),
device=device,
dtype=target_dtype,
)
neg_mask = _to_device_dtype(
_first_tensor(batch.negative_attention_mask), device=device
)
if neg_embeds is None:
raise ValueError(
"SANA-WM streaming CFG requires negative prompt embeds."
)
pos_embeds, neg_embeds, pos_mask, neg_mask = (
_align_sana_wm_cfg_text_conditions(
pos_embeds, neg_embeds, pos_mask, neg_mask
)View on GitHub (pinned to 0132848349)
Solutions
- Run the text-encoding stage before the streaming denoiser so pos prompt embeds exist
- Ensure every request carries a prompt (even an empty string) that gets encoded
- Validate pcfg.get_pos_prompt_embeds(batch) is not None before dispatch
Example fix
# before resp = streaming_stage.forward(batch, server_args) # no embeds # after batch = text_encode_stage.forward(batch, server_args) # sets pos prompt embeds resp = streaming_stage.forward(batch, server_args)
Defensive patterns
Strategy: validation
Validate before calling
if pcfg.get_pos_prompt_embeds(batch) is None:
batch = text_encode_stage.forward(batch, server_args)
assert pcfg.get_pos_prompt_embeds(batch) is not None Type guard
def has_pos_embeds(pcfg, batch) -> bool:
return pcfg.get_pos_prompt_embeds(batch) is not None Try / catch
null
Prevention
- Make text encoding precede denoising in every pipeline variant
- Default empty prompts to encoded empty strings
- Integration-test the minimal happy path after any pipeline edit
When it happens
Trigger: Running the streaming denoiser without the prompt-encoding stage in the pipeline, or the encoder failing to attach pos prompt embeds to the Req; empty-prompt requests where embeds were skipped rather than encoded as empty.
Common situations: Pipeline misordering (denoiser before text encoder); prompt field absent in the request so downstream embeds are None; batch.extra dropping embeds during transfer.
Related errors
- SANA-WM realtime denoising expects this tick's pre-noised ch
- SANA-WM realtime denoising requires a realtime session
- chunk plan {plan} does not cover the incoming {incoming.shap
- SANA-WM streaming CFG requires negative prompt embeds.
- SANA-WM streaming denoising expects 5D latents (B, C, T, H,
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8e70dff86ccae606.
Report an issue: GitHub.