Files
CyberGril/spike/hel857/resource_check.py
T
zonggongandmultica-agent e31ae2d946 HEL-857: approved Mem0 isolation spike - zero-model gates all pass, A/B synthetic scenarios within 26/60 real-call budget
- Fixed mem0 source commit 2c81af3 (2.2.1) in isolated venv, qdrant embedded + fastembed local zh embeddings (95.3MB, within 500MB cap)
- Gate0 transport-level persistent debit ledger: 61st call blocked pre-send, failures count, cross-process persistence, retries disabled+counted (fake transport, zero network)
- Gate1 qdrant embedded checks: keyword_search functional (Chinese segmentation gap recorded honestly), restart subprocess, clean-copy restore, no telemetry collections
- Gate2 privacy with stub LLM: P1-P5 zero leak, first-share timing F1-F6 (failed/cancel/unconfirmed no migration, ack+judged migrates told content with anchors, duplicate receipt idempotent), full backup incl. unshared internal memories restores clean
- A/B same-material same-criteria: Mem0 paraphrase recall strictly better than current lexical path (S3, model answers in Chinese), S1-S9 all pass, no regression
- Headline findings: Chinese input extracted as English memories (default upstream prompt), BM25 lexical channel inert for Chinese, ADD-only infer confirmed with our update orchestration, custom metadata needs direct payload read
- 26/60 real outbound via persistent ledger (incl. one parse-failure retry), usage/latency per row; embeddings 28/500; HEL-835 quota untouched
- Experiment branch only: no merge to main/product, no deploy, no real-profile access; handoff JSON + dual-base requirement checks pass

Co-authored-by: multica-agent <github@multica.ai>
2026-10-25 23:19:26 +08:00

43 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""模型资源下载前核对(批准范围第2条):远端文件清单+大小,合计 ≤500,000,000 字节。
fastembed 对 BAAI/bge-small-zh-v1.5 的实际来源是 Qdrant 官方 ONNX 转换镜像
Qdrant/bge-small-zh-v1.5(model_optimized.onnx),二者为同一模型的 ONNX 形态;
此事实如实记录,不冒充未发生的下载路径。
"""
from __future__ import annotations
import json
import urllib.request
from .common import write_result
REPOS = ["Qdrant/bge-small-zh-v1.5", "Qdrant/bm25"]
CAP = 500_000_000
def fetch(repo: str) -> dict:
url = f"https://huggingface.co/api/models/{repo}?blobs=true"
with urllib.request.urlopen(url, timeout=30) as r:
d = json.loads(r.read().decode())
files = {f["rfilename"]: f.get("size") or 0 for f in d["siblings"]}
return {"repo": repo, "files": files, "total_bytes": sum(files.values())}
def main(argv: list[str]) -> dict:
manifests = [fetch(r) for r in REPOS]
total = sum(m["total_bytes"] for m in manifests)
out = {
"ok": total <= CAP,
"repos": manifests,
"combined_bytes": total,
"cap_bytes": CAP,
"note": "BAAI/bge-small-zh-v1.5 由 fastembed 解析为 Qdrant 官方 ONNX 镜像(同模型)",
}
write_result("resource_manifest_pre.json", out)
return out
if __name__ == "__main__":
raise SystemExit(0 if main([])["ok"] else 1)