{"record":{"id":"fe96b183025bdf8f","repo":"sgl-project/sglang","slug":"decoder-model-output-type-must-be-x0-or-v-got","errorCode":null,"errorMessage":"decoder_model_output_type must be 'x0' or 'v', got {arch.decoder_model_output_type!r}.","messagePattern":"decoder_model_output_type must be 'x0' or 'v', got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/decoders/ltx_2_5_diffusion_decoder.py","lineNumber":653,"sourceCode":"            hidden_states = hidden_states[:, 1:]\n        return hidden_states\n\n\nclass LTX2VideoDiffusionDecoder3d(nn.Module):\n    \"\"\"Stages 1-4 upsample the latent into a context volume; stage 5 denoises\n    patchified pixels conditioned on it.\"\"\"\n\n    def __init__(self, config: LTX25DiffusionDecoderConfig) -> None:\n        super().__init__()\n        arch = config.arch_config\n        stage_channels = tuple(arch.decoder_stage_channels)\n        stage_depths = tuple(arch.decoder_stage_depths)\n        stage_kernels = tuple(tuple(k) for k in arch.decoder_stage_kernels)\n        upsample_strides = tuple(tuple(s) for s in arch.decoder_upsample_strides)\n        reductions = tuple(arch.decoder_upsample_channel_reductions)\n\n        if arch.decoder_model_output_type not in (\"x0\", \"v\"):\n            raise ValueError(\n                \"decoder_model_output_type must be 'x0' or 'v', got \"\n                f\"{arch.decoder_model_output_type!r}.\"\n            )\n        # An inconsistent pair would only fail deep inside the first block.\n        for stage_idx, reduction in enumerate(reductions):\n            expected = stage_channels[stage_idx] // reduction\n            if stage_channels[stage_idx + 1] != expected:\n                raise ValueError(\n                    f\"decoder_stage_channels[{stage_idx + 1}] must be \"\n                    f\"{expected}, got {stage_channels[stage_idx + 1]}.\"\n                )\n\n        self.patch_size = arch.patch_size\n        self.out_channels = arch.out_channels\n        self.timestep_scale_multiplier = arch.decoder_timestep_scale_multiplier\n        self.model_output_type = arch.decoder_model_output_type\n        self.default_num_inference_steps = arch.decoder_num_inference_steps\n        self.temporal_compression_ratio = arch.temporal_compression_ratio","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/decoders/ltx_2_5_diffusion_decoder.py#L635-L671","documentation":"The decoder is constructed to predict either x0 (denoised prediction) or v (velocity) parameterization, and the rest of the sampler must know which. __init__ validates arch.decoder_model_output_type against the allowed set ('x0','v') and raises for anything else.","triggerScenarios":"Building the decoder from an arch/config object where decoder_model_output_type is misspelled, None, 'V', 'velocity', or from a config written for a different sampler convention.","commonSituations":"Hand-editing model configs; converting a checkpoint whose config uses a different naming for velocity prediction; case-sensitive string comparisons after dataclass defaults changed.","solutions":["Set decoder_model_output_type to exactly 'x0' or 'v' in the model arch config","If porting a checkpoint, determine which parameterization its training used (velocity → 'v', denoised → 'x0') and set accordingly","Add Literal['x0','v'] typing / config validation upstream so bad values fail at parse time"],"exampleFix":"# before\narch.decoder_model_output_type = \"velocity\"\n# after\narch.decoder_model_output_type = \"v\"","handlingStrategy":"validation","validationCode":"if arch.decoder_model_output_type not in (\"x0\", \"v\"):\n    raise ValueError(\"decoder_model_output_type must be 'x0' or 'v'\")","typeGuard":"from typing import Literal\nOutputType = Literal[\"x0\", \"v\"]\ndef is_output_type(t: str) -> bool:\n    return t in (\"x0\", \"v\")","tryCatchPattern":"try:\n    decoder = Ltx25DiffusionDecoder(arch)\nexcept ValueError as e:\n    if \"decoder_model_output_type\" in str(e):\n        arch.decoder_model_output_type = \"v\"  # or 'x0' per checkpoint convention\n        decoder = Ltx25DiffusionDecoder(arch)\n    else:\n        raise","preventionTips":["Store output type in one config field typed as Literal['x0','v']","When porting checkpoints, inspect training code/sampler to determine the parameterization"],"tags":["config-validation","diffusion","model-config","ltx-2"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}