{"record":{"id":"3548b95038fb257d","repo":"sgl-project/sglang","slug":"adaln-cache-must-cover-at-least-one-timestep-plan","errorCode":null,"errorMessage":"AdaLN cache must cover at least one timestep plan","messagePattern":"AdaLN cache must cover at least one timestep plan","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/tools/build_minimax_h3_adaln_cache.py","lineNumber":167,"sourceCode":"\ndef main() -> None:\n    args = _parse_args()\n    if args.num_inference_steps < 2 and args.timesteps is None:\n        raise ValueError(\"--num-inference-steps must be at least 2\")\n    mode_variant = _MODE_VARIANTS[args.mode]\n    if args.model_variant != mode_variant:\n        raise ValueError(f\"--mode {args.mode} requires {mode_variant}\")\n    device = torch.device(args.device)\n    if device.type != \"cuda\" or not torch.cuda.is_available():\n        raise ValueError(\"MiniMax H3 AdaLN cache must be built on CUDA\")\n\n    index_path = args.transformer_path / \"model.safetensors.index.json\"\n    with index_path.open() as f:\n        weight_map = json.load(f)[\"weight_map\"]\n\n    plans = _cache_timestep_plans(args)\n    if not plans or any(plan.numel() == 0 for plan in plans):\n        raise ValueError(\"AdaLN cache must cover at least one timestep plan\")\n    max_plan_length = max(plan.numel() for plan in plans)\n    plan_timesteps = torch.zeros((len(plans), max_plan_length), dtype=torch.float32)\n    plan_lengths = torch.tensor([plan.numel() for plan in plans], dtype=torch.int64)\n    block_params = torch.empty(\n        (len(plans), max_plan_length, _NUM_BLOCKS, _BLOCK_PARAM_WIDTH),\n        dtype=torch.bfloat16,\n    )\n    final_params = torch.empty(\n        (len(plans), max_plan_length, _FINAL_PARAM_WIDTH), dtype=torch.bfloat16\n    )\n\n    with ExitStack() as stack:\n        files = {\n            filename: stack.enter_context(\n                safe_open(\n                    str(args.transformer_path / filename),\n                    framework=\"pt\",\n                    device=\"cpu\",","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/tools/build_minimax_h3_adaln_cache.py#L149-L185","documentation":"Validation error: the AdaLN cache configuration covers zero timestep plans; at least one timestep plan must be covered by the cache.","triggerScenarios":"A --timesteps schedule that filters down to an empty set, or argument combinations (steps/shift/schedule) yielding zero effective timesteps for every plan.","commonSituations":"Custom timestep strings with only invalid/filtered entries; edge-valued scheduler parameters.","solutions":["Inspect _cache_timestep_plans to see how plans derive from your args","Use the default --num-inference-steps instead of a custom --timesteps","Ensure the timestep list is non-empty and within valid range"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"plans = _cache_timestep_plans(args)\nif not plans or any(p.numel() == 0 for p in plans):\n    raise SystemExit(\"empty timestep plan; check --timesteps/--num-inference-steps\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate custom --timesteps strings are non-empty and in-range","Dry-run plan computation before long builds"],"tags":["cli","validation","diffusion","timesteps"],"backgroundTag":"empty-schedule","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","contentChangedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}