{"record":{"id":"3d27c9b7a0dd8047","repo":"sgl-project/sglang","slug":"noise-aug-must-be-in-0-1-got-noise-aug","errorCode":null,"errorMessage":"noise_aug must be in [0, 1], got {noise_aug}","messagePattern":"noise_aug must be in \\[0, 1\\], got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/condition_noise.py","lineNumber":44,"sourceCode":"    *,\n    condition_shapes: Sequence[Sequence[int]],\n    target_latent_t: int,\n    imgvid_cond_num_frames: int,\n    seed: int,\n    noise_aug: float,\n) -> torch.Tensor:\n    \"\"\"Apply the imgvid-condition RF noise recipe to packed clean rows.\n\n    ``condition_shapes`` contains ``(latent_t, latent_h, latent_w)`` in packed\n    visual-condition order. A new CPU generator with the same row seed is\n    created for every condition. Under the dependent-noise policy, each draw\n    uses the target temporal length plus the template's imgvid-condition frame\n    count, then slices the prefix matching the current condition.\n    \"\"\"\n\n    noise_aug = float(noise_aug)\n    if not 0.0 <= noise_aug <= 1.0:\n        raise ValueError(f\"noise_aug must be in [0, 1], got {noise_aug}\")\n    if noise_aug == 1.0:\n        return clean_rows\n    if clean_rows.ndim != 2 or int(clean_rows.shape[1]) != 96:\n        raise ValueError(\n            \"clean imgvid condition rows must have shape [n, 96], got \"\n            f\"{list(clean_rows.shape)}\"\n        )\n\n    target_latent_t = int(target_latent_t)\n    imgvid_cond_num_frames = int(imgvid_cond_num_frames)\n    if target_latent_t <= 0:\n        raise ValueError(f\"target_latent_t must be positive, got {target_latent_t}\")\n    if imgvid_cond_num_frames <= 0:\n        raise ValueError(\n            \"imgvid_cond_num_frames must be positive when condition rows exist, \"\n            f\"got {imgvid_cond_num_frames}\"\n        )\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/condition_noise.py#L26-L62","documentation":"minimax_h3_imgvid_cond_noise_aug_rows validates that the imgvid condition noise augmentation coefficient is a float within [0,1]. Values below 0.0 or above 1.0 (or NaN after float() conversion, which fails the chained comparison) raise this ValueError before any tensor work happens.","triggerScenarios":"Passing noise_aug outside [0,1] (e.g. 1.5, -0.1) or a non-finite value like float('nan') to minimax_h3_imgvid_cond_noise_aug_rows, typically sourced from sampler config or request parameters.","commonSituations":"Copying a sigma-style noise schedule value (unbounded) into noise_aug, exposing noise_aug as a user-facing sampling parameter without clamping, or a config default changed between versions.","solutions":["Clamp noise_aug to [0,1] at the config/request boundary: noise_aug = min(max(float(noise_aug), 0.0), 1.0)","Check for NaN and reject or default the request parameter before invoking the stage","Validate the sampler config schema with bounds 0<=noise_aug<=1 at load time"],"exampleFix":"// before\nrows = minimax_h3_imgvid_cond_noise_aug_rows(clean_rows, noise_aug=cfg.sigma, ...)\n// after\nnoise_aug = min(max(float(cfg.noise_aug), 0.0), 1.0)\nrows = minimax_h3_imgvid_cond_noise_aug_rows(clean_rows, noise_aug=noise_aug, ...)","handlingStrategy":"validation","validationCode":"noise_aug = float(noise_aug)\nassert math.isfinite(noise_aug) and 0.0 <= noise_aug <= 1.0, 'noise_aug out of range'","typeGuard":"def valid_noise_aug(x) -> bool:\n    try:\n        v = float(x)\n    except (TypeError, ValueError):\n        return False\n    return math.isfinite(v) and 0.0 <= v <= 1.0","tryCatchPattern":null,"preventionTips":["Clamp at the request boundary","Validate sampler config bounds at load time"],"tags":["minimax-h3","noise-aug","parameter-validation","range-check"],"backgroundTag":"parameter-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}