sgl-project/sglang · error · ValueError
Unsupported AVAE normalization_type={self.normalization_type
Error message
Unsupported AVAE normalization_type={self.normalization_type!r}. What it means
_denormalize_latent supports 'none', tanh-based, and group-norm style normalization; anything else in normalization_type leaves latents un-denormalized, which would silently corrupt decode output, so an unrecognized value raises at decode time.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/cosmos3_avae.py:212
return self.hop_size
def get_latent_num_samples(self, num_audio_samples: int) -> int:
return int(num_audio_samples) // self.hop_size
def get_audio_num_samples(self, num_latent_samples: int) -> int:
return int(num_latent_samples) * self.hop_size
def _denormalize_latent(self, latent: torch.Tensor) -> torch.Tensor:
if self.normalization_type == "tanh":
in_dtype = latent.dtype
x = torch.clamp(
latent.float() / self.tanh_output_scale,
-self.tanh_clamp,
self.tanh_clamp,
)
return (torch.atanh(x) * self.tanh_input_scale).to(in_dtype)
if self.normalization_type != "none":
raise ValueError(
f"Unsupported AVAE normalization_type={self.normalization_type!r}."
)
return latent
@torch.no_grad()
def decode(self, latent: torch.Tensor) -> torch.Tensor:
squeeze = latent.ndim == 2
if squeeze:
latent = latent.unsqueeze(0)
decoder_dtype = next(self.decoder.parameters()).dtype
decoder_device = next(self.decoder.parameters()).device
z = self._denormalize_latent(latent.to(decoder_device)).to(decoder_dtype)
audio = self.decoder(z).clamp(-1.0, 1.0).to(latent.dtype)
return audio.squeeze(0) if squeeze else audio
EntryClass = Cosmos3AVAEAudioTokenizer
View on GitHub (pinned to 0132848349)
Solutions
- Set normalization_type to a supported value ('none' or the tanh/group variants accepted by this class)
- Check the exact supported set in this file's normalization parsing (just above, near line 195-210) and align spelling
- Upgrade the library if the checkpoint needs a newer normalization type
Example fix
# before
config = {"normalization_type": "LayerNorm"}
# after
config = {"normalization_type": "none"} Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_NORMS = {"none"} # plus tanh/group variants per this class
if config.get("normalization_type", "none") not in SUPPORTED_NORMS:
config["normalization_type"] = "none" # or fail loudly at load time Type guard
def is_supported_norm(t: str) -> bool:
return t in {"none"} # extend with the class's supported set Try / catch
try:
frames = avae.decode(latent)
except ValueError as e:
if "normalization_type" in str(e):
raise RuntimeError("bad AVAE config; fix normalization_type") from e
raise Prevention
- Validate normalization_type at config load, not at decode time
- Normalize casing/whitespace on config strings before constructing the AVAE
When it happens
Trigger: Decoding with a Cosmos3 AVAE whose config sets normalization_type to an unsupported string (typo like 'groupnorm ' or 'layer_norm') or a new scheme this version doesn't implement.
Common situations: Config typos or casing differences; porting a config from a newer Cosmos3 version that added a new normalization type; checkpoint config using an alias not handled by this code version.
Related errors
- Cosmos3 AVAE dec_strides product must equal hop_size: produc
- This browser cannot encode H.264 MP4
- H.264 encoder did not return MP4 decoder config
- This browser does not support gzip stream decoding
- delta payload size mismatch: expected ${expectedSize}, got $
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/56e1c2cfeaaba5e6.
Report an issue: GitHub.