sgl-project/sglang · error · ValueError
Unsupported latent_log_var: {latent_log_var}
Error message
Unsupported latent_log_var: {latent_log_var} What it means
The LTX-2.3 condition encoder sizes its conv_out head according to latent_log_var: 'per_channel' doubles the channels, 'uniform'/'constant' add one channel, and 'none' leaves them unchanged. Any other string raises this ValueError in __init__.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/ltx_2_3_condition_encoder.py:168
)
block, feature_channels = _make_ltx23_encoder_block(
block_name=block_name,
block_config=block_config,
in_channels=feature_channels,
spatial_padding_mode=spatial_padding_mode,
)
self.down_blocks.append(block)
self.conv_norm_out = LTX23VideoPixelNorm(dim=1, eps=1e-8)
self.conv_act = nn.SiLU()
conv_out_channels = latent_channels
if latent_log_var == "per_channel":
conv_out_channels *= 2
elif latent_log_var in {"uniform", "constant"}:
conv_out_channels += 1
elif latent_log_var != "none":
raise ValueError(f"Unsupported latent_log_var: {latent_log_var}")
self.conv_out = LTX2VideoCausalConv3d(
in_channels=feature_channels,
out_channels=conv_out_channels,
kernel_size=3,
stride=1,
spatial_padding_mode=spatial_padding_mode,
)
def forward(self, sample: torch.Tensor) -> torch.Tensor:
frames_count = int(sample.shape[2])
if (frames_count - 1) % 8 != 0:
frames_to_crop = (frames_count - 1) % 8
sample = sample[:, :, :-frames_to_crop, ...]
hidden_states = _patchify_video(sample, self.patch_size)
hidden_states = self.conv_in(hidden_states, causal=True)
View on GitHub (pinned to 0132848349)
Solutions
- Set latent_log_var to one of 'per_channel', 'uniform', 'constant', or 'none' in the config
- Upgrade sglang if the checkpoint uses a newly introduced mode
- If writing a custom config, copy the value verbatim from the official checkpoint's config
Example fix
// before "latent_log_var": "per-channel" // after "latent_log_var": "per_channel"
Defensive patterns
Strategy: validation
Validate before calling
VALID_LOG_VAR = {'per_channel', 'uniform', 'constant', 'none'}
assert cfg['latent_log_var'] in VALID_LOG_VAR, f"latent_log_var must be one of {VALID_LOG_VAR}" Type guard
def is_valid_latent_log_var(v: str) -> bool:
return v in {'per_channel', 'uniform', 'constant', 'none'} Prevention
- Use the checkpoint's original latent_log_var value unchanged
- Watch for spelling variants like 'per-channel' vs 'per_channel'
- Upgrade sglang when loading newer LTX-2.3 checkpoints
When it happens
Trigger: Constructing LTX2ConditionEncoder with latent_log_var set to something outside {per_channel, uniform, constant, none} — e.g. 'per-channel', 'disabled', None handled as a string, or a value from an incompatible checkpoint config.
Common situations: Loading a checkpoint whose config records a newer latent_log_var mode not supported by this sglang version; renaming/typo issues in converted configs; mixing diffusers LTX config keys with this implementation.
Related errors
- Unsupported LTX-2.3 encoder block: {block_name}
- Unsupported down_block_type: {down_block_type}
- Unsupported time_compression_ratio: {temporal_compression_ra
- Unsupported up_block_type: {up_block_type}
- Unsupported time_compression_ratio: {time_compression_ratio}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/32c38f47a2608002.
Report an issue: GitHub.