#!/usr/bin/env python3 """Upload the project code, docs and measurement results to the HF repo.""" from __future__ import annotations import argparse import os import sys from pathlib import Path from huggingface_hub import HfApi # this script lives in bench/, the repo root is its parent REPO = Path(__file__).resolve().parent.parent MSG = """EPM: expert paging CPU inference for MiniCPM-V-4.7-35B-A3B Q4_K_M Port the 8 GiB expert pager to openbmb/MiniCPM-V-4.7-35B-A3B-Q4_K_M.gguf (19.71 GiB, qwen35moe, 40 layers, 256 experts, top-8). Measured under an 8 GiB / no-swap ceiling enforced by tools/strict8g.py: 5.83 tok/s median (N=9), peak anon RSS 7799 MiB, VmSwap 0, 9/9 strict_ok. Unmodified llama.cpp cannot load the model at that ceiling. Correctness: 3-layer verification passes; 5 runs x 48 tokens x 248144 vocab logits bit-identical. Port-specific changes: GGUF BOOL-array header fix, calibrated SDQ_RESERVE_MB, two expert size classes, hybrid SSM/attention thread behaviour. """ def main() -> int: ap = argparse.ArgumentParser() ap.add_argument("--repo", default=os.environ.get("EPM_HF_REPO", "HelloSun/minicpm47woek")) ap.add_argument("--folder", default=str(REPO)) ap.add_argument("--message", default=MSG) ap.add_argument("--dry-run", action="store_true") a = ap.parse_args() api = HfApi() print("whoami:", api.whoami()["name"]) if a.dry_run: print("dry run, not uploading") return 0 api.upload_folder( folder_path=a.folder, repo_id=a.repo, repo_type="model", ignore_patterns=[".git/*", "__pycache__/*", "*.pyc", "*.so", "bench/results/.*", "*.gguf", "*.bin"], commit_message=a.message, ) print(f"uploaded -> https://huggingface.co/{a.repo}") return 0 if __name__ == "__main__": sys.exit(main())