INNER CODE UNIT · Python

_validate_args

invergent-ai/surogate · surogate/serve/tools/reference/qwen3_5/cli.py:110

def _validate_args(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
    if Path(args.weights).suffix != ".sinfer":
        parser.error("--weights must name a .sinfer artifact")
    if args.decode < 0:
        parser.error("--decode must be nonnegative")
    if args.prefill_chunk is not None and args.prefill_chunk <= 0:
        parser.error("--prefill-chunk must be positive")
    if args.vision_attention_limit is not None and args.vision_attention_limit <= 0:
        parser.error("--vision-attention-limit must be positive")
    if args.draft_head and args.mtp_draft_tokens == 0:
        parser.error("--draft-head requires --mtp-draft-tokens greater than zero")
    try:
        gpu_memory = parse_bytes(args.gpu_memory)
        headroom = parse_bytes(args.headroom)
    except ValueError as exc:
        parser.error(f"invalid memory size: {exc}")
    if gpu_memory is not None and gpu_memory <= 0:
        parser.error("--gpu-memory must be positive or auto")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…