INNER CODE UNIT · Python

parse_ids

invergent-ai/surogate · surogate/serve/tools/reference/qwen3_5_moe/cli.py:42

def parse_ids(text: str) -> list[int]:
    return [int(value) for value in text.replace(",", " ").split()]


def parse_bytes(text: str | None) -> int | None:
    if text is None or text.strip().lower() == "auto":
        return None
    units = {"gib": 1 << 30, "mib": 1 << 20, "gb": 10**9, "mb": 10**6}
    lowered = text.strip().lower()
    for suffix, scale in units.items():
        if lowered.endswith(suffix):
            return int(float(lowered[: -len(suffix)]) * scale)
    return int(lowered)


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--weights", required=True, help="hybrid MoE .sinfer artifact")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…