code + h3 labels/cache 2026-11-17
Browse files- .gitattributes +1 -0
- cache/h3/enrich.jsonl +3 -0
- code/README.md +49 -0
- code/eval/compare.py +93 -0
- code/hfeco/__init__.py +0 -0
- code/hfeco/classify.py +467 -0
- code/hfeco/discover.py +145 -0
- code/hfeco/enrich.py +262 -0
- code/hfeco/families/__init__.py +7 -0
- code/hfeco/families/h3.py +83 -0
- code/hfeco/families/h3_reference.json +1 -0
- code/hfeco/family.py +86 -0
- code/hfeco/hub.py +60 -0
- code/hfeco/metrics.py +138 -0
- code/hfeco/pipeline.py +82 -0
- code/hfeco/store.py +57 -0
- code/octo-hf/README.md +61 -0
- code/octo-hf/hf_basemodel.py +176 -0
- code/scripts/build_reference.py +44 -0
- code/scripts/daily.py +73 -0
- code/space/README.md +10 -0
- code/space/index.html +379 -0
- labels/h3/latest.parquet +3 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
cache/h3/enrich.jsonl filter=lfs diff=lfs merge=lfs -text
|
cache/h3/enrich.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ec589be405f34f0ce5291cd4f63298da31543d86043d7a78ab60b3a575ed42b
|
| 3 |
+
size 43492102
|
code/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax 开源生态统计
|
| 2 |
+
|
| 3 |
+
每天扫一遍 Hugging Face,找出 MiniMax 开源模型的下游仓库,判断每个仓库真正属于哪个官方模型、是什么关系,记录下载量,生成看板。
|
| 4 |
+
|
| 5 |
+
- 看板:私有 Space `MiniMaxAI/oss-ecosystem`(静态页面,数据每天更新)
|
| 6 |
+
- 数据:私有数据集 `MiniMaxAI/oss-ecosystem-data`
|
| 7 |
+
- 定时任务:HF Jobs,`MiniMaxAI` 名下,每天 00:30 UTC
|
| 8 |
+
|
| 9 |
+
## 目录
|
| 10 |
+
|
| 11 |
+
```
|
| 12 |
+
hfeco/ 通用流水线,不含任何具体模型的知识
|
| 13 |
+
family.py 一个模型家族需要提供什么(成员、搜索词、结构指纹、元数据规则……)
|
| 14 |
+
families/h3.py MiniMax-H3 家族的全部规则;h3_reference.json 是官方文件哈希和抽查数值
|
| 15 |
+
discover.py 找候选仓库(Model tree 逐层往下、名字、标签、模型卡全文、Space)
|
| 16 |
+
enrich.py 只读文件头和少量字节收集证据(不下载权重)
|
| 17 |
+
classify.py 三档证据判定:属于哪个成员、什么关系、base_model 声明对不对
|
| 18 |
+
metrics.py 每日下载(相邻快照相减)和看板数据
|
| 19 |
+
store.py 存储布局
|
| 20 |
+
scripts/daily.py 每日任务入口(本地和 HF Jobs 一样跑)
|
| 21 |
+
scripts/build_reference.py 生成某个家族的官方参考数据
|
| 22 |
+
space/ 看板页面
|
| 23 |
+
octo-hf/ Octo-patch 新场景:给下游仓库提 base_model PR
|
| 24 |
+
eval/ 分类准确率评估(独立标注 + 对比)
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## 存储
|
| 28 |
+
|
| 29 |
+
```
|
| 30 |
+
raw/<family>/YYYY-MM-DD.parquet 每天一份,只追加不修改;每日下载在读取时由相邻两份相减得到
|
| 31 |
+
labels/<family>/latest.parquet 当前分类结果,带规则版本号,可随时重算
|
| 32 |
+
cache/<family>/enrich.jsonl 每个仓库的证据,按仓库 sha 缓存,没变的仓库不重复读
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## 加一个模型家族
|
| 36 |
+
|
| 37 |
+
1. 写 `hfeco/families/<key>.py`,按 `family.py` 的字段填:成员和官方仓库、搜索词、能区分成员的结构指纹(独有的层、config 里的架构名、训练元数据里的字样)、抽查用的张量名。
|
| 38 |
+
2. 在 `hfeco/families/__init__.py` 里注册。
|
| 39 |
+
3. `python scripts/build_reference.py --family <key>` 生成官方参考数据。
|
| 40 |
+
4. `python scripts/daily.py --family <key>` 试跑,用 `eval/` 的方法抽样核对准确率。
|
| 41 |
+
|
| 42 |
+
定时任务和看板会自动带上新家族(看板顶部出现家族切换)。
|
| 43 |
+
|
| 44 |
+
## 本地运行
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
python scripts/daily.py --family h3 # 只在本地生成,不推送
|
| 48 |
+
python scripts/daily.py --family h3 --push # 推送到数据集和 Space
|
| 49 |
+
```
|
code/eval/compare.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Compare classifier labels with independent hand labels.
|
| 2 |
+
|
| 3 |
+
python eval/compare.py [--family h3]
|
| 4 |
+
|
| 5 |
+
Inputs: data/labels/<family>/latest.parquet, eval/labels_part*.json (independent
|
| 6 |
+
labels for a stratified sample) and eval/seed_awesome.json (hand-checked entries from
|
| 7 |
+
the integrations list, lineage only).
|
| 8 |
+
"""
|
| 9 |
+
import argparse
|
| 10 |
+
import json
|
| 11 |
+
import sys
|
| 12 |
+
from collections import Counter
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
import pandas as pd
|
| 16 |
+
|
| 17 |
+
ROOT = Path(__file__).resolve().parent.parent
|
| 18 |
+
sys.path.insert(0, str(ROOT))
|
| 19 |
+
from hfeco import store # noqa: E402
|
| 20 |
+
|
| 21 |
+
ap = argparse.ArgumentParser()
|
| 22 |
+
ap.add_argument("--family", default="h3")
|
| 23 |
+
ap.add_argument("--show", action="store_true", help="print every disagreement")
|
| 24 |
+
a = ap.parse_args()
|
| 25 |
+
|
| 26 |
+
lab = pd.read_parquet(store.LOCAL / "labels" / a.family / "latest.parquet").set_index(["kind", "repo_id"])
|
| 27 |
+
lab["evidence"] = lab.evidence.apply(json.loads)
|
| 28 |
+
hand = []
|
| 29 |
+
for p in sorted((ROOT / "eval").glob("labels_part*.json")):
|
| 30 |
+
hand += json.load(open(p))
|
| 31 |
+
sample = {x["repo_id"]: x for x in json.load(open(ROOT / "eval" / "sample.json"))}
|
| 32 |
+
|
| 33 |
+
# Relations that count as the same answer for this check.
|
| 34 |
+
SAME_REL = {"no-weights": "no-weights", None: None}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def norm_rel(x):
|
| 38 |
+
return None if x in (None, "null", "") else x
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
rows = []
|
| 42 |
+
for h in hand:
|
| 43 |
+
rid = h["repo_id"]
|
| 44 |
+
key = (sample.get(rid, {}).get("kind", "model"), rid)
|
| 45 |
+
if key not in lab.index:
|
| 46 |
+
rows.append({**h, "ours_lin": "(not found)", "ours_rel": None, "stratum": sample.get(rid, {}).get("stratum")})
|
| 47 |
+
continue
|
| 48 |
+
o = lab.loc[key]
|
| 49 |
+
rows.append({"repo_id": rid, "stratum": sample.get(rid, {}).get("stratum"), "kind": key[0],
|
| 50 |
+
"hand_lin": h["lineage"], "hand_rel": norm_rel(h.get("relation")), "hand_conf": h.get("confidence"),
|
| 51 |
+
"ours_lin": o.lineage, "ours_rel": norm_rel(o.relation), "ours_conf": o.confidence,
|
| 52 |
+
"reason": h.get("reason"), "evidence": o.evidence})
|
| 53 |
+
df = pd.DataFrame(rows)
|
| 54 |
+
df["lin_ok"] = df.hand_lin == df.ours_lin
|
| 55 |
+
# "in family as H3" is what the dashboard counts; check it as its own yes/no question.
|
| 56 |
+
df["is_h3_hand"] = df.hand_lin == "H3"
|
| 57 |
+
df["is_h3_ours"] = df.ours_lin == "H3"
|
| 58 |
+
fam_rel = df[df.hand_lin.isin(["H3", "H3-Image", "H3-Image-PE"]) & df.lin_ok]
|
| 59 |
+
fam_rel = fam_rel.assign(rel_ok=fam_rel.hand_rel == fam_rel.ours_rel)
|
| 60 |
+
|
| 61 |
+
print(f"independent sample: {len(df)} repos")
|
| 62 |
+
print(f" lineage agreement: {df.lin_ok.mean():.1%} ({df.lin_ok.sum()}/{len(df)})")
|
| 63 |
+
tp = (df.is_h3_hand & df.is_h3_ours).sum()
|
| 64 |
+
fp = (~df.is_h3_hand & df.is_h3_ours).sum()
|
| 65 |
+
fn = (df.is_h3_hand & ~df.is_h3_ours).sum()
|
| 66 |
+
print(f" counted as H3: precision {tp / max(1, tp + fp):.1%} ({tp}/{tp + fp}), recall {tp / max(1, tp + fn):.1%} ({tp}/{tp + fn})")
|
| 67 |
+
print(f" relation agreement (where lineage agrees, family repos): {fam_rel.rel_ok.mean():.1%} "
|
| 68 |
+
f"({fam_rel.rel_ok.sum()}/{len(fam_rel)})")
|
| 69 |
+
print(" by our confidence:")
|
| 70 |
+
for c, g in df.groupby("ours_conf"):
|
| 71 |
+
print(f" {c}: {g.lin_ok.mean():.1%} lineage agreement ({g.lin_ok.sum()}/{len(g)})")
|
| 72 |
+
print(" confusion (hand -> ours):", dict(Counter(zip(df.hand_lin, df.ours_lin)).most_common()))
|
| 73 |
+
|
| 74 |
+
seed = json.load(open(ROOT / "eval" / "seed_awesome.json"))
|
| 75 |
+
seed["MiniMaxAI/MiniMax-H3-Image-PE"] = "H3-Image-PE"
|
| 76 |
+
s = [(rid, lin, lab.loc[("model", rid)].lineage if ("model", rid) in lab.index else "(not found)")
|
| 77 |
+
for rid, lin in seed.items()]
|
| 78 |
+
ok = sum(1 for _, a_, b in s if a_ == b)
|
| 79 |
+
print(f"\nseed list (hand-checked integrations entries): {ok}/{len(s)} lineage agreement")
|
| 80 |
+
|
| 81 |
+
if a.show:
|
| 82 |
+
print("\n--- disagreements (independent sample) ---")
|
| 83 |
+
for r in df[~df.lin_ok].itertuples():
|
| 84 |
+
print(f"{r.repo_id} [{r.stratum}] hand={r.hand_lin}/{r.hand_rel} ours={r.ours_lin}/{r.ours_rel} ({r.ours_conf})")
|
| 85 |
+
print(f" hand: {r.reason}")
|
| 86 |
+
print(f" ours: {r.evidence}")
|
| 87 |
+
print("\n--- relation disagreements ---")
|
| 88 |
+
for r in fam_rel[~fam_rel.rel_ok].itertuples():
|
| 89 |
+
print(f"{r.repo_id} {r.hand_lin}: hand={r.hand_rel} ours={r.ours_rel} | hand: {r.reason}")
|
| 90 |
+
print("\n--- seed disagreements ---")
|
| 91 |
+
for rid, a_, b in s:
|
| 92 |
+
if a_ != b:
|
| 93 |
+
print(rid, "seed", a_, "ours", b)
|
code/hfeco/__init__.py
ADDED
|
File without changes
|
code/hfeco/classify.py
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Decide, for each candidate, which official model of a family it belongs to and how.
|
| 2 |
+
|
| 3 |
+
lineage a member lineage of the family (e.g. H3 | H3-Image | H3-Image-PE), or
|
| 4 |
+
unrelated | unknown
|
| 5 |
+
relation official | adapter | finetune | merge | quantized | repackage | mirror |
|
| 6 |
+
component | tool | no-weights | app (Space) | dataset
|
| 7 |
+
family True when the repo is about the family at all (even if the member is unknown)
|
| 8 |
+
|
| 9 |
+
Evidence is tiered. Tier 1 is structural and decides on its own; tier 2 (declared base,
|
| 10 |
+
repo content, dates) decides only when tier 1 is silent; names alone (tier 3) give at
|
| 11 |
+
most low confidence. Every decision keeps its reasons in `evidence`. All family-specific
|
| 12 |
+
facts come from the Family object (hfeco/families/*.py).
|
| 13 |
+
"""
|
| 14 |
+
import json
|
| 15 |
+
import re
|
| 16 |
+
|
| 17 |
+
import numpy as np
|
| 18 |
+
|
| 19 |
+
VERSION = "2026-11-17.5"
|
| 20 |
+
DERIVED = {"adapter", "finetune", "merge", "quantized", "repackage", "mirror", "component"}
|
| 21 |
+
HF_RELATIONS = {"adapter", "finetune", "merge", "quantized"}
|
| 22 |
+
SAME = 1e-3 # probe distance below this = same weights (bf16 -> fp16 copies land at ~0)
|
| 23 |
+
|
| 24 |
+
LORA_KEY = re.compile(r"lora_[ABab]\b|lora_down|lora_up|lora\.(down|up)|\.lokr_|\.hada_|\.alpha$|\.diff(_b)?$",
|
| 25 |
+
re.I)
|
| 26 |
+
QUANT_NAME = re.compile(r"fp8|int8|int4|int6|nf4|nvfp4|mxfp|fp4|w4a\d|w6a8|w8a8|gptq|awq|svdq|nunchaku|"
|
| 27 |
+
r"q[2-8]_[0k]|q[2-8]_k|iq[1-4]|bnb|sdnq|convrot|[2-8]-?bit\b|gguf|exl2|hqq|quant", re.I)
|
| 28 |
+
MERGE_NAME = re.compile(r"merge|merged|mix\b|mixed|fused|\bfuse\b|blend", re.I)
|
| 29 |
+
REPACK_NAME = re.compile(r"comfy|diffusers|single[-_ ]?file|repack|split|bf16|fp16|fp32|pruned|mlx", re.I)
|
| 30 |
+
TUNED_NAME = re.compile(r"finetun|fine-tun|\bft\b|turbo|lightning|distill|\d+[-_ ]?steps?|\bacc\b|fast|"
|
| 31 |
+
r"lcm|dmd|pdmd|singularity|eros|nsfw|uncensor|heretic|abliterat", re.I)
|
| 32 |
+
DISTILL_NAME = re.compile(r"turbo|lightning|distill|\d+[-_ ]?steps?|\bacc\b|lcm|dmd|pdmd|fast", re.I)
|
| 33 |
+
NSFW = re.compile(r"nsfw|porn|hentai|nude|nudity|\bsex|dildo|cumshot|\bcum\b|pussy|deepthroat|blowjob|"
|
| 34 |
+
r"erotic|\beros\b|xxx|uncensor", re.I)
|
| 35 |
+
LORA_NAME = re.compile(r"lora|lycoris|locon|loha|lokr|adapter", re.I)
|
| 36 |
+
AUTHORS = {} # family key -> authors who publish family repos (filled by classify_all)
|
| 37 |
+
COMMUNITY = {} # family key -> weight-file index over all probed repos (for whole-repo copies)
|
| 38 |
+
TEXT_LLM_TYPES = re.compile(r"^(qwen|llama|mistral|gemma|phi|glm|deepseek|minimax_m)", re.I)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def declared_graph(raw):
|
| 42 |
+
"""child -> list of (relation, parent) as parsed by HF from each card."""
|
| 43 |
+
return {r.repo_id: [tuple(p.split(":", 1)) for p in r.hf_parents] for r in raw.itertuples()}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def declared_member(rid, g, fam, seen=None):
|
| 47 |
+
"""Nearest family base reached by following declared parents."""
|
| 48 |
+
lob = fam.lineage_of_base()
|
| 49 |
+
if rid in lob:
|
| 50 |
+
return lob[rid]
|
| 51 |
+
seen = seen or set()
|
| 52 |
+
if rid in seen:
|
| 53 |
+
return None
|
| 54 |
+
seen.add(rid)
|
| 55 |
+
best = None
|
| 56 |
+
for _, p in g.get(rid, []):
|
| 57 |
+
if p in lob:
|
| 58 |
+
return lob[p]
|
| 59 |
+
best = best or declared_member(p, g, fam, seen)
|
| 60 |
+
return best
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def probe_match(probe, fam):
|
| 64 |
+
"""Compare a probed tensor slice with the official ones -> (lineage, rel_distance, source)."""
|
| 65 |
+
if not probe or not probe.get("values"):
|
| 66 |
+
return None
|
| 67 |
+
v = np.array(probe["values"], dtype=np.float64)
|
| 68 |
+
best = None
|
| 69 |
+
for ref in fam.ref["probes"]:
|
| 70 |
+
r = np.array(ref["values"][:len(v)], dtype=np.float64)
|
| 71 |
+
if len(r) != len(v):
|
| 72 |
+
continue
|
| 73 |
+
d = float(np.linalg.norm(v - r) / (np.linalg.norm(r) + 1e-12))
|
| 74 |
+
if best is None or d < best[1]:
|
| 75 |
+
best = (ref["lineage"], d, ref["source"])
|
| 76 |
+
return best
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def sha_mirror(files, fam):
|
| 80 |
+
wb = [f for f in files or [] if f.get("sha256") and f.get("size", 0) > 1_000_000]
|
| 81 |
+
if not wb:
|
| 82 |
+
return None
|
| 83 |
+
total = sum(f["size"] for f in wb)
|
| 84 |
+
hit, any_b = {}, 0
|
| 85 |
+
for f in wb:
|
| 86 |
+
ref = fam.ref["sha256"].get(f["sha256"])
|
| 87 |
+
if ref:
|
| 88 |
+
any_b += f["size"]
|
| 89 |
+
for lin in ref.get("lineages") or [ref.get("lineage")]:
|
| 90 |
+
hit[lin] = hit.get(lin, 0) + f["size"]
|
| 91 |
+
if not hit:
|
| 92 |
+
return None
|
| 93 |
+
lin = max(hit.items(), key=lambda x: x[1])[0]
|
| 94 |
+
return lin, any_b / total
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def _res(lineage, relation, family, confidence, evidence, flags):
|
| 98 |
+
return dict(lineage=lineage, relation=relation, family=family, confidence=confidence,
|
| 99 |
+
evidence=evidence, flags=flags, copy_of=None)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def classify_model(r, ev, g, cutoff, fam):
|
| 103 |
+
rid = r["repo_id"]
|
| 104 |
+
E, tier1 = [], {}
|
| 105 |
+
score = {k: 0.0 for k in fam.lineages}
|
| 106 |
+
name = rid.split("/")[1]
|
| 107 |
+
readme = (ev or {}).get("readme") or ""
|
| 108 |
+
text = " ".join([name, " ".join(r["tags"]), readme])
|
| 109 |
+
flags = ["nsfw"] if ("not-for-all-audiences" in r["tags"] or NSFW.search(rid)) else []
|
| 110 |
+
lob = fam.lineage_of_base()
|
| 111 |
+
|
| 112 |
+
if rid in lob:
|
| 113 |
+
return _res(lob[rid], "official", True, "high", ["官方仓库"], flags)
|
| 114 |
+
if rid.startswith("MiniMaxAI/"):
|
| 115 |
+
return _res("unrelated", None, False, "high", ["MiniMax 其他模型的官方仓库"], flags)
|
| 116 |
+
decl = declared_member(rid, g, fam)
|
| 117 |
+
if ev is None:
|
| 118 |
+
return _res("unrelated", None, False, "medium",
|
| 119 |
+
["名字里的关键词是别的词的一部分,且没有任何相关信号"], flags)
|
| 120 |
+
if any(e.startswith("fatal") for e in ev.get("errors", [])):
|
| 121 |
+
return _res(decl or "unknown", None, bool(decl), "low",
|
| 122 |
+
["仓库读不到(可能已删除或设了访问限制)"] + ([f"声明底模属于 {decl}"] if decl else []), flags)
|
| 123 |
+
|
| 124 |
+
weight_ev = [] # tier-1 hits that come from the weights themselves
|
| 125 |
+
|
| 126 |
+
def t1(lin, why, from_weights=False):
|
| 127 |
+
tier1[lin] = tier1.get(lin, 0) + 1
|
| 128 |
+
E.append(why)
|
| 129 |
+
if from_weights:
|
| 130 |
+
weight_ev.append(lin)
|
| 131 |
+
|
| 132 |
+
files = ev.get("files", [])
|
| 133 |
+
keys = ev.get("st_keys") or (ev.get("gguf") or {}).get("tensor_names") or {}
|
| 134 |
+
markers = " ".join(keys.get("markers", []))
|
| 135 |
+
sig = ev.get("dit_sig") or {}
|
| 136 |
+
hits = sig.get("sig_hits", sig.get("h3_dim_hits", 0))
|
| 137 |
+
is_dit = hits >= 8
|
| 138 |
+
other_dit = sig.get("block_tensors", 0) >= 20 and hits == 0
|
| 139 |
+
is_lora = bool(LORA_KEY.search(markers)) or bool(ev.get("has_adapter_config"))
|
| 140 |
+
meta = json.dumps(ev.get("st_meta") or {}).lower()
|
| 141 |
+
cfg = ev.get("config") or {}
|
| 142 |
+
cfg_s = f'{cfg.get("model_type") or ""} {" ".join(cfg.get("architectures") or [])}'
|
| 143 |
+
gguf_arch = str(((ev.get("gguf") or {}).get("kv") or {}).get("general.architecture") or "")
|
| 144 |
+
patterns = " ".join(keys.get("patterns", []))
|
| 145 |
+
is_text_llm = (bool(TEXT_LLM_TYPES.search(str(cfg.get("model_type") or ""))) or "ForCausalLM" in cfg_s
|
| 146 |
+
or bool(TEXT_LLM_TYPES.search(gguf_arch))
|
| 147 |
+
or (not is_dit and bool(re.search(r"layers\.N\.(self_attn|mlp|linear_attn)", patterns))))
|
| 148 |
+
readable = bool(keys.get("n")) or bool(ev.get("gguf")) or bool(cfg)
|
| 149 |
+
mi = json.dumps(ev.get("model_index") or {})
|
| 150 |
+
ctx = {"markers": markers, "sig": sig, "is_dit": is_dit, "is_lora": is_lora}
|
| 151 |
+
|
| 152 |
+
# ---- Tier 1: structural evidence --------------------------------------------------
|
| 153 |
+
mirror = sha_mirror(files, fam)
|
| 154 |
+
if mirror and mirror[1] >= 0.5:
|
| 155 |
+
t1(mirror[0], f"{mirror[1]:.0%} 的权重文件与官方 {mirror[0]} 逐字节相同", True)
|
| 156 |
+
for rx, lin, why, full_only in fam.marker_rules:
|
| 157 |
+
if rx.search(markers) and not (full_only and is_lora):
|
| 158 |
+
t1(lin, why, not is_lora)
|
| 159 |
+
if fam.extra_structural:
|
| 160 |
+
for lin, why in fam.extra_structural(ev, ctx):
|
| 161 |
+
t1(lin, why, True)
|
| 162 |
+
pm = probe_match(ev.get("probe"), fam)
|
| 163 |
+
if pm:
|
| 164 |
+
lin, d, src = pm
|
| 165 |
+
if d < SAME:
|
| 166 |
+
t1(lin, f"抽查的权重数值与官方 {src} 完全相同", True)
|
| 167 |
+
elif d < 0.6:
|
| 168 |
+
t1(lin, f"抽查的权重数值最接近官方 {lin}(相对差异 {d:.1%}),是在它上面改过的", True)
|
| 169 |
+
for sub, lin in fam.index_rules:
|
| 170 |
+
if sub in mi:
|
| 171 |
+
t1(lin, f"model_index.json 是 {lin} 的管线")
|
| 172 |
+
break
|
| 173 |
+
for rx, lin in fam.config_rules:
|
| 174 |
+
if rx.search(cfg_s):
|
| 175 |
+
t1(lin, f"config 的模型结构是 {lin}")
|
| 176 |
+
break
|
| 177 |
+
created = str(r.get("created_at") or "")
|
| 178 |
+
if meta not in ("{}", ""):
|
| 179 |
+
for rx, lin, why in fam.meta_rules:
|
| 180 |
+
m = rx.search(meta)
|
| 181 |
+
# Metadata strings can echo a repo name; a member released after the repo was
|
| 182 |
+
# created cannot be its training base, so skip such a match.
|
| 183 |
+
if m and not (created and cutoff.get(lin) and created < cutoff[lin]):
|
| 184 |
+
t1(lin, f"{why}({m.group(0)})")
|
| 185 |
+
break
|
| 186 |
+
pe_like = bool(fam.text_member and is_text_llm and (
|
| 187 |
+
fam.text_member_hint.search(text) or (mirror and mirror[0] == fam.text_member)
|
| 188 |
+
or decl == fam.text_member))
|
| 189 |
+
if pe_like:
|
| 190 |
+
t1(fam.text_member, f"是文本大模型,且标明是 {fam.text_member}")
|
| 191 |
+
|
| 192 |
+
# ---- Tier 2: declared base, repo content, dates ------------------------------------
|
| 193 |
+
if decl:
|
| 194 |
+
score[decl] += 5
|
| 195 |
+
E.append(f"声明的 base_model 指向 {decl}")
|
| 196 |
+
video_member = next((m.lineage for m in fam.members if m.modality == "video"), None)
|
| 197 |
+
if video_member and ev.get("has_video_media") and not is_text_llm:
|
| 198 |
+
score[video_member] += 3
|
| 199 |
+
E.append("仓库里有视频样例")
|
| 200 |
+
member_hit = False
|
| 201 |
+
for rx, lin, w, why, skip_text in fam.card_rules:
|
| 202 |
+
if rx.search(readme) and not (skip_text and is_text_llm):
|
| 203 |
+
score[lin] += w
|
| 204 |
+
E.append(why)
|
| 205 |
+
member_hit = member_hit or lin != fam.default_member
|
| 206 |
+
if fam.family_text and fam.family_text.search(readme) and not member_hit:
|
| 207 |
+
score[fam.default_member] += 2
|
| 208 |
+
pt = r.get("pipeline_tag") or ""
|
| 209 |
+
for m in fam.members:
|
| 210 |
+
if m.modality in ("video", "audio") and m.modality in pt:
|
| 211 |
+
score[m.lineage] += 2
|
| 212 |
+
if is_dit:
|
| 213 |
+
for m in fam.members:
|
| 214 |
+
if m.modality != "text":
|
| 215 |
+
score[m.lineage] += 2
|
| 216 |
+
for lin, day in cutoff.items():
|
| 217 |
+
if created and day and created < day:
|
| 218 |
+
score[lin] -= 20
|
| 219 |
+
if lin != fam.text_member:
|
| 220 |
+
E.append(f"创建于 {created[:10]},早于 {lin} 发布,不可能基于 {lin}")
|
| 221 |
+
|
| 222 |
+
# ---- Tier 3: names -----------------------------------------------------------------
|
| 223 |
+
for m in fam.members:
|
| 224 |
+
if m.text_hint and m.text_hint.search(name):
|
| 225 |
+
score[m.lineage] += 1.5
|
| 226 |
+
if fam.family_text and fam.family_text.search(name):
|
| 227 |
+
score[fam.default_member] += 1
|
| 228 |
+
|
| 229 |
+
# ---- Family gate -------------------------------------------------------------------
|
| 230 |
+
fam_text = bool(fam.family_text and fam.family_text.search(text)) or any(
|
| 231 |
+
m.text_hint and m.text_hint.search(text) for m in fam.members if m.modality != "text")
|
| 232 |
+
if other_dit and not tier1 and not decl and not fam_text:
|
| 233 |
+
return _res("unrelated", None, False, "high", ["是别的模型的权重(层的尺寸不对),也没有提到这个家族"], flags)
|
| 234 |
+
author_hint = bool(fam.name_hint and fam.name_hint.search(name) and r["author"] in AUTHORS.get(fam.key, ()))
|
| 235 |
+
if not (decl or tier1 or is_dit or fam_text or author_hint):
|
| 236 |
+
return _res("unrelated", None, False, "medium", ["没有任何相关信号"], flags)
|
| 237 |
+
if author_hint and not (decl or tier1 or is_dit or fam_text):
|
| 238 |
+
E.append("作者发布过这个家族的衍生模型,名字里也有家族关键词")
|
| 239 |
+
score[fam.default_member] += 1
|
| 240 |
+
|
| 241 |
+
# ---- Decide lineage ----------------------------------------------------------------
|
| 242 |
+
possible = [m.lineage for m in fam.members if m.modality != "text" and score[m.lineage] > -10]
|
| 243 |
+
if tier1:
|
| 244 |
+
if len(tier1) == 1:
|
| 245 |
+
lineage, conf = next(iter(tier1)), "high"
|
| 246 |
+
else:
|
| 247 |
+
# Collections hold files of several members; let the repo's own framing choose.
|
| 248 |
+
ranked = sorted(tier1, key=lambda k: -score[k])
|
| 249 |
+
if score[ranked[0]] - score[ranked[1]] >= 2:
|
| 250 |
+
lineage, conf = ranked[0], "medium"
|
| 251 |
+
E.append("仓库里同时有 " + "、".join(tier1) + " 的权重,按仓库名和声明归到 " + ranked[0])
|
| 252 |
+
else:
|
| 253 |
+
lineage, conf = "unknown", "low"
|
| 254 |
+
E.append("结构证据互相矛盾:" + " / ".join(tier1))
|
| 255 |
+
elif is_dit and len(possible) == 1:
|
| 256 |
+
lineage, conf = possible[0], "medium"
|
| 257 |
+
E.append(f"结构是这个家族的 DiT,且创建时只有 {possible[0]} 已发布")
|
| 258 |
+
else:
|
| 259 |
+
ranked = sorted(score.items(), key=lambda x: -x[1])
|
| 260 |
+
(l1, s1), (_, s2) = ranked[0], ranked[1]
|
| 261 |
+
if s1 >= 4 and s1 - s2 >= 3:
|
| 262 |
+
lineage, conf = l1, "medium"
|
| 263 |
+
elif s1 > 0 and s1 - s2 >= 1:
|
| 264 |
+
lineage, conf = l1, "low"
|
| 265 |
+
else:
|
| 266 |
+
lineage, conf = "unknown", "low"
|
| 267 |
+
E.append("看得出属于这个家族,但分不清是哪个模型")
|
| 268 |
+
|
| 269 |
+
pe_like = pe_like or (lineage == fam.text_member and is_text_llm)
|
| 270 |
+
copy_of = community_mirror(r, ev, fam)
|
| 271 |
+
if copy_of:
|
| 272 |
+
flags.append("copy")
|
| 273 |
+
E.append(f"整仓权重与更早的 {copy_of} 逐字节相同,是重新上传")
|
| 274 |
+
rel = relation(r, ev, is_lora, is_dit or bool(weight_ev), is_text_llm, mirror, pm, name, E, pe_like, fam,
|
| 275 |
+
readable, other_dit, lineage)
|
| 276 |
+
if rel == "tool":
|
| 277 |
+
E.append("权重不是来自这个家族,是给它用的周边工具")
|
| 278 |
+
if DISTILL_NAME.search(name) and rel in ("finetune", "adapter", "merge", "quantized"):
|
| 279 |
+
flags.append("distilled")
|
| 280 |
+
out = _res(lineage, rel, True, conf, E, flags)
|
| 281 |
+
out["copy_of"] = copy_of
|
| 282 |
+
return out
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
def relation(r, ev, is_lora, is_family_weights, is_text_llm, mirror, pm, name, E, pe_like, fam,
|
| 286 |
+
readable, other_dit, lineage):
|
| 287 |
+
wbytes = ev.get("weight_bytes", 0)
|
| 288 |
+
card = ev.get("card") or {}
|
| 289 |
+
main = ev.get("main_weight") or ""
|
| 290 |
+
if ev.get("n_weight_files", 0) == 0 or wbytes < 1_000_000:
|
| 291 |
+
return "no-weights"
|
| 292 |
+
if mirror and mirror[1] >= 0.9:
|
| 293 |
+
return "mirror"
|
| 294 |
+
if is_text_llm and not pe_like:
|
| 295 |
+
if fam.text_component and fam.text_component.search(name + " " + json.dumps(ev.get("config"))):
|
| 296 |
+
E.append("是这个家族自带的文本编码器")
|
| 297 |
+
return "component"
|
| 298 |
+
return "tool"
|
| 299 |
+
if not is_family_weights and not pe_like:
|
| 300 |
+
if fam.component_names and (fam.component_names.search(name) or fam.component_names.search(main)):
|
| 301 |
+
return "component"
|
| 302 |
+
# "tool" needs positive evidence that the weights come from another model;
|
| 303 |
+
# unreadable weights (gated, .bin, unparsed) fall through to the name rules below.
|
| 304 |
+
if (other_dit or (readable and not is_lora)) and not is_lora:
|
| 305 |
+
return "tool"
|
| 306 |
+
if is_lora or (not readable and LORA_NAME.search(name + " " + main)):
|
| 307 |
+
return "adapter"
|
| 308 |
+
bm = card.get("base_model")
|
| 309 |
+
multi = [b for b in bm if isinstance(b, str)] if isinstance(bm, list) else []
|
| 310 |
+
same = pm and pm[1] < SAME
|
| 311 |
+
if (card.get("base_model_relation") == "merge" or len(multi) >= 2
|
| 312 |
+
or any(p.startswith("merge:") for p in r["hf_parents"])) and not same:
|
| 313 |
+
return "merge"
|
| 314 |
+
if same:
|
| 315 |
+
return "repackage"
|
| 316 |
+
st_d = ev.get("st_dtypes") or {}
|
| 317 |
+
low = sum(v for k, v in st_d.items() if k in ("F8_E4M3", "F8_E5M2", "I8", "U8", "I4", "U4"))
|
| 318 |
+
quant = (ev.get("has_gguf") or (st_d and low / max(1, sum(st_d.values())) >= 0.25)
|
| 319 |
+
or QUANT_NAME.search(name) or QUANT_NAME.search(main)
|
| 320 |
+
or "quantization_config" in json.dumps(ev.get("config") or {}))
|
| 321 |
+
if quant:
|
| 322 |
+
native = fam.native_quant.get(lineage) if fam.native_quant else None
|
| 323 |
+
if native and not ev.get("has_gguf") and native.search(name + " " + main) \
|
| 324 |
+
and not re.search(r"gguf|mlx|[2-8]-?bit|int[48]|awq|gptq", name, re.I):
|
| 325 |
+
E.append(f"官方 {lineage} 本身就是这种量化格式,这里只是换了打包方式")
|
| 326 |
+
return "repackage"
|
| 327 |
+
return "quantized"
|
| 328 |
+
if MERGE_NAME.search(name):
|
| 329 |
+
return "merge"
|
| 330 |
+
if pm:
|
| 331 |
+
return "finetune"
|
| 332 |
+
if REPACK_NAME.search(name) and not TUNED_NAME.search(name):
|
| 333 |
+
return "repackage"
|
| 334 |
+
return "finetune"
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
WEIGHT_EXT = (".safetensors", ".gguf", ".bin", ".pt", ".pth", ".ckpt", ".onnx", ".npz", ".sft")
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
def _weights(ev):
|
| 341 |
+
return {f["sha256"]: f["size"] for f in (ev or {}).get("files", [])
|
| 342 |
+
if f.get("sha256") and f.get("size", 0) > 1_000_000 and f["name"].lower().endswith(WEIGHT_EXT)}
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def community_mirror(r, ev, fam):
|
| 346 |
+
"""Whole-repo copy of an earlier community repo: each covers >= 90% of the other's
|
| 347 |
+
weight bytes. Being collected into a bigger repo, or copying part of one, does not count."""
|
| 348 |
+
c = COMMUNITY.get(fam.key)
|
| 349 |
+
if not c:
|
| 350 |
+
return None
|
| 351 |
+
mine = _weights(ev)
|
| 352 |
+
total = sum(mine.values())
|
| 353 |
+
if not total:
|
| 354 |
+
return None
|
| 355 |
+
me = str(r.get("created_at") or "")
|
| 356 |
+
shared = {}
|
| 357 |
+
for sha, size in mine.items():
|
| 358 |
+
for other in c["by_sha"].get(sha, ()):
|
| 359 |
+
if other != r["repo_id"]:
|
| 360 |
+
shared[other] = shared.get(other, 0) + size
|
| 361 |
+
for other, b in sorted(shared.items(), key=lambda x: -x[1]):
|
| 362 |
+
if b / total < 0.9:
|
| 363 |
+
break
|
| 364 |
+
o_total = c["total"][other]
|
| 365 |
+
if o_total and b / o_total >= 0.9 and c["created"].get(other, "9999") < me:
|
| 366 |
+
return other
|
| 367 |
+
return None
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
def classify_space(r, model_labels, fam):
|
| 371 |
+
lins, E = set(), []
|
| 372 |
+
for m in r["space_models"]:
|
| 373 |
+
lab = model_labels.get(m)
|
| 374 |
+
if lab and lab["family"] and lab["lineage"] in fam.lineages:
|
| 375 |
+
lins.add(lab["lineage"])
|
| 376 |
+
if lins:
|
| 377 |
+
E.append("调用的模型:" + "、".join(sorted(lins)))
|
| 378 |
+
text = r["repo_id"] + " " + " ".join(r["tags"])
|
| 379 |
+
if not lins:
|
| 380 |
+
lins = _text_members(text, r, fam)
|
| 381 |
+
if lins:
|
| 382 |
+
E.append("名字或说明里提到这个家族")
|
| 383 |
+
if not lins:
|
| 384 |
+
return _res("unrelated", "app", False, "medium", ["没有调用这个家族的模型,名字里的关键词另有所指"], [])
|
| 385 |
+
lineage = fam.default_member if fam.default_member in lins else sorted(lins)[0]
|
| 386 |
+
return _res(lineage, "app", True, "high" if r["space_models"] else "low", E, [])
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def classify_dataset(r, fam):
|
| 390 |
+
lins = _text_members(r["repo_id"] + " " + " ".join(r["tags"]), r, fam)
|
| 391 |
+
if not lins:
|
| 392 |
+
return _res("unrelated", "dataset", False, "medium", ["名字里的关键词另有所指"], [])
|
| 393 |
+
lin = sorted(lins)[0]
|
| 394 |
+
return _res(lin, "dataset", True, "low", ["名字或数据卡提到 " + lin], [])
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
def _text_members(text, r, fam):
|
| 398 |
+
for m in fam.members:
|
| 399 |
+
if m.text_hint and m.modality != "text" and m.text_hint.search(text):
|
| 400 |
+
return {m.lineage}
|
| 401 |
+
if (fam.family_text and fam.family_text.search(text)) or any(s.startswith("fulltext") for s in r["sources"]):
|
| 402 |
+
return {fam.default_member}
|
| 403 |
+
# The author publishes family models and the name carries the family keyword as a token.
|
| 404 |
+
if fam.name_hint and fam.name_hint.search(r["repo_id"].split("/")[1]) and r["author"] in AUTHORS.get(fam.key, ()):
|
| 405 |
+
return {fam.default_member}
|
| 406 |
+
return set()
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
def classify_all(raw_today, cache, fam):
|
| 410 |
+
"""raw_today: one day's raw frame for this family. Returns a list of label dicts."""
|
| 411 |
+
g = declared_graph(raw_today)
|
| 412 |
+
created = dict(zip(raw_today.repo_id, raw_today.created_at))
|
| 413 |
+
AUTHORS[fam.key] = {r.author for r in raw_today.itertuples() if r.kind == "model" and not
|
| 414 |
+
r.repo_id.startswith("MiniMaxAI/") and (declared_member(r.repo_id, g, fam)
|
| 415 |
+
or fam.family_text.search(r.repo_id))}
|
| 416 |
+
by_sha, total = {}, {}
|
| 417 |
+
for rid, ev in cache.items():
|
| 418 |
+
w = _weights(ev)
|
| 419 |
+
total[rid] = sum(w.values())
|
| 420 |
+
for sha in w:
|
| 421 |
+
by_sha.setdefault(sha, []).append(rid)
|
| 422 |
+
COMMUNITY[fam.key] = {"by_sha": by_sha, "total": total,
|
| 423 |
+
"created": {k: str(v or "9999") for k, v in created.items()}}
|
| 424 |
+
# A derivative cannot predate its base repo; the default member never needs the check.
|
| 425 |
+
cutoff = {m.lineage: str(created.get(m.base) or "") for m in fam.members if m.lineage != fam.default_member}
|
| 426 |
+
out, mlabels = [], {}
|
| 427 |
+
rows = raw_today.to_dict("records")
|
| 428 |
+
for r in rows:
|
| 429 |
+
if r["kind"] != "model":
|
| 430 |
+
continue
|
| 431 |
+
lab = classify_model(r, cache.get(r["repo_id"]), g, cutoff, fam)
|
| 432 |
+
lab.update(declared_status(r, lab, g, fam))
|
| 433 |
+
mlabels[r["repo_id"]] = lab
|
| 434 |
+
out.append({"kind": "model", "repo_id": r["repo_id"], **lab})
|
| 435 |
+
for r in rows:
|
| 436 |
+
if r["kind"] == "space":
|
| 437 |
+
out.append({"kind": "space", "repo_id": r["repo_id"], **classify_space(r, mlabels, fam)})
|
| 438 |
+
elif r["kind"] == "dataset":
|
| 439 |
+
out.append({"kind": "dataset", "repo_id": r["repo_id"], **classify_dataset(r, fam)})
|
| 440 |
+
for o in out:
|
| 441 |
+
o["classifier_version"] = VERSION
|
| 442 |
+
o["family_key"] = fam.key
|
| 443 |
+
return out
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
def declared_status(r, lab, g, fam):
|
| 447 |
+
decl = declared_member(r["repo_id"], g, fam)
|
| 448 |
+
hf_rel = r["hf_parents"][0].split(":")[0] if r["hf_parents"] else None
|
| 449 |
+
out = {"declared_lineage": decl, "declared_relation": hf_rel, "declared_status": None,
|
| 450 |
+
"proposed_base_model": None, "proposed_relation": None}
|
| 451 |
+
if not lab["family"] or lab["relation"] not in DERIVED or lab["lineage"] not in fam.lineages:
|
| 452 |
+
return out
|
| 453 |
+
base = fam.base_of(lab["lineage"])
|
| 454 |
+
if decl is None:
|
| 455 |
+
out["declared_status"] = "missing"
|
| 456 |
+
elif decl != lab["lineage"]:
|
| 457 |
+
out["declared_status"] = "wrong_base"
|
| 458 |
+
elif lab["relation"] in HF_RELATIONS and hf_rel and hf_rel != lab["relation"] \
|
| 459 |
+
and any(p.split(":", 1)[1] == base for p in r["hf_parents"]):
|
| 460 |
+
out["declared_status"] = "wrong_relation"
|
| 461 |
+
else:
|
| 462 |
+
out["declared_status"] = "ok"
|
| 463 |
+
if out["declared_status"] != "ok":
|
| 464 |
+
out["proposed_base_model"] = base
|
| 465 |
+
# HF only knows four relations; for the rest we set base_model and let HF infer.
|
| 466 |
+
out["proposed_relation"] = lab["relation"] if lab["relation"] in HF_RELATIONS else None
|
| 467 |
+
return out
|
code/hfeco/discover.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Find every repo that might be downstream of a model family, on purpose too wide.
|
| 2 |
+
|
| 3 |
+
Classification decides later what really belongs to the family; this step only makes
|
| 4 |
+
sure nothing is missed, because a day without a download snapshot cannot be recovered.
|
| 5 |
+
"""
|
| 6 |
+
import datetime as dt
|
| 7 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 8 |
+
|
| 9 |
+
from . import hub
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _iso(x):
|
| 13 |
+
return x.isoformat() if isinstance(x, (dt.date, dt.datetime)) else x
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def _card(o):
|
| 17 |
+
cd = getattr(o, "card_data", None) or getattr(o, "cardData", None)
|
| 18 |
+
return cd.to_dict() if hasattr(cd, "to_dict") else (cd or {})
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _as_list(x):
|
| 22 |
+
if x is None:
|
| 23 |
+
return []
|
| 24 |
+
return [x] if isinstance(x, str) else [str(i) for i in x]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def record(kind, o, now):
|
| 28 |
+
tags = list(o.tags or [])
|
| 29 |
+
card = _card(o)
|
| 30 |
+
parents = [] # direct parents as HF parsed them: (relation, parent)
|
| 31 |
+
for t in tags:
|
| 32 |
+
if t.startswith("base_model:"):
|
| 33 |
+
p = t.split(":")
|
| 34 |
+
if len(p) == 3:
|
| 35 |
+
parents.append(f"{p[1]}:{p[2]}")
|
| 36 |
+
return {
|
| 37 |
+
"kind": kind,
|
| 38 |
+
"repo_id": o.id,
|
| 39 |
+
"author": o.id.split("/")[0],
|
| 40 |
+
"fetched_at": now,
|
| 41 |
+
"downloads_30d": getattr(o, "downloads", None),
|
| 42 |
+
"downloads_all_time": getattr(o, "downloads_all_time", None),
|
| 43 |
+
"likes": getattr(o, "likes", None),
|
| 44 |
+
"created_at": _iso(getattr(o, "created_at", None)),
|
| 45 |
+
"last_modified": _iso(getattr(o, "last_modified", None)),
|
| 46 |
+
"sha": getattr(o, "sha", None),
|
| 47 |
+
"pipeline_tag": getattr(o, "pipeline_tag", None),
|
| 48 |
+
"library_name": getattr(o, "library_name", None),
|
| 49 |
+
"tags": tags,
|
| 50 |
+
"gated": str(getattr(o, "gated", None)),
|
| 51 |
+
"card_base_model": _as_list(card.get("base_model")),
|
| 52 |
+
"card_base_model_relation": card.get("base_model_relation"),
|
| 53 |
+
"license": card.get("license_name") or card.get("license"),
|
| 54 |
+
"hf_parents": parents,
|
| 55 |
+
"space_sdk": getattr(o, "sdk", None),
|
| 56 |
+
"space_models": list(getattr(o, "models", None) or []),
|
| 57 |
+
"space_stage": (getattr(o, "runtime", None).stage if getattr(o, "runtime", None) else None),
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def discover(fam, log=print, recurse_workers=8):
|
| 62 |
+
BASES = fam.bases
|
| 63 |
+
now = dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds")
|
| 64 |
+
found = {} # (kind, id) -> record
|
| 65 |
+
sources = {} # (kind, id) -> set of discovery channels
|
| 66 |
+
|
| 67 |
+
def add(kind, objs, src):
|
| 68 |
+
for o in objs:
|
| 69 |
+
k = (kind, o.id)
|
| 70 |
+
if k not in found:
|
| 71 |
+
found[k] = record(kind, o, now)
|
| 72 |
+
sources.setdefault(k, set()).add(src)
|
| 73 |
+
|
| 74 |
+
# 1. Declared model trees, followed downwards until nothing new appears.
|
| 75 |
+
frontier = list(BASES)
|
| 76 |
+
seen_parent = set()
|
| 77 |
+
depth = 0
|
| 78 |
+
while frontier:
|
| 79 |
+
depth += 1
|
| 80 |
+
todo = [p for p in frontier if p not in seen_parent]
|
| 81 |
+
seen_parent.update(todo)
|
| 82 |
+
with ThreadPoolExecutor(recurse_workers) as ex:
|
| 83 |
+
res = list(ex.map(lambda p: (p, hub.listing("model", filter=f"base_model:{p}")), todo))
|
| 84 |
+
frontier = []
|
| 85 |
+
for p, kids in res:
|
| 86 |
+
add("model", kids, f"tree:{p}" if p in BASES else "tree:descendant")
|
| 87 |
+
frontier += [k.id for k in kids]
|
| 88 |
+
log(f"tree depth {depth}: {len(todo)} parents, {sum(len(k) for _, k in res)} children")
|
| 89 |
+
|
| 90 |
+
# 2. Name, tag and README full-text search.
|
| 91 |
+
for q in fam.name_queries: # Hub name search is a substring match on the repo id
|
| 92 |
+
add("model", hub.listing("model", search=q), f"name:{q}")
|
| 93 |
+
add("dataset", hub.listing("dataset", search=q), f"name:{q}")
|
| 94 |
+
add("space", hub.listing("space", search=q), f"name:{q}")
|
| 95 |
+
for t in fam.tag_filters:
|
| 96 |
+
add("model", hub.listing("model", filter=t), f"tag:{t}")
|
| 97 |
+
log(f"after name/tag search: {len(found)}")
|
| 98 |
+
|
| 99 |
+
missing = []
|
| 100 |
+
for q in fam.fulltext_queries:
|
| 101 |
+
for kind in ("model", "dataset", "space"):
|
| 102 |
+
for rid in hub.full_text(q, kind):
|
| 103 |
+
k = (kind, rid)
|
| 104 |
+
sources.setdefault(k, set()).add(f"fulltext:{q}")
|
| 105 |
+
if k not in found:
|
| 106 |
+
missing.append(k)
|
| 107 |
+
# 3. Spaces that load a family model.
|
| 108 |
+
for b in BASES:
|
| 109 |
+
add("space", hub.listing("space", models=b), f"space-uses:{b}")
|
| 110 |
+
log(f"after full-text + spaces: {len(found)} listed, {len(set(missing))} need a per-repo fetch")
|
| 111 |
+
|
| 112 |
+
# 4. Children of any candidate that names the family explicitly (catches repos that only
|
| 113 |
+
# declare a community repo, e.g. Comfy-Org/MiniMax-H3, as their base).
|
| 114 |
+
extra_parents = [rid for (kind, rid) in found if kind == "model" and rid not in seen_parent
|
| 115 |
+
and _looks_family(rid, found[(kind, rid)], fam)]
|
| 116 |
+
with ThreadPoolExecutor(recurse_workers) as ex:
|
| 117 |
+
res = list(ex.map(lambda p: (p, hub.listing("model", filter=f"base_model:{p}")), extra_parents))
|
| 118 |
+
for p, kids in res:
|
| 119 |
+
add("model", kids, "tree:descendant")
|
| 120 |
+
log(f"children of {len(extra_parents)} name hits: {sum(len(k) for _, k in res)}")
|
| 121 |
+
|
| 122 |
+
# Per-repo fetch for full-text-only hits.
|
| 123 |
+
def fetch(k):
|
| 124 |
+
try:
|
| 125 |
+
return k, hub.info(k[0], k[1])
|
| 126 |
+
except Exception:
|
| 127 |
+
return k, None
|
| 128 |
+
with ThreadPoolExecutor(recurse_workers) as ex:
|
| 129 |
+
for k, o in ex.map(fetch, sorted(set(m for m in missing if m not in found))):
|
| 130 |
+
if o is not None:
|
| 131 |
+
found[k] = record(k[0], o, now)
|
| 132 |
+
|
| 133 |
+
rows = []
|
| 134 |
+
for k, r in found.items():
|
| 135 |
+
r["sources"] = sorted(sources.get(k, []))
|
| 136 |
+
rows.append(r)
|
| 137 |
+
log(f"total candidates: {len(rows)}")
|
| 138 |
+
return rows
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def _looks_family(rid, rec, fam):
|
| 142 |
+
tags = rec.get("tags") or []
|
| 143 |
+
return bool(fam.family_text.search(rid)
|
| 144 |
+
or any(m.text_hint and m.text_hint.search(rid) for m in fam.members)
|
| 145 |
+
or any(t in tags or rec.get("library_name") == t for t in fam.tag_filters))
|
code/hfeco/enrich.py
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Collect per-repo evidence for classification without downloading weights.
|
| 2 |
+
|
| 3 |
+
Everything here is read through small requests: the file list (with LFS sha256),
|
| 4 |
+
safetensors / GGUF headers via HTTP Range, a few hundred values of one tensor,
|
| 5 |
+
model_index.json and the README. Results are cached by repo sha.
|
| 6 |
+
"""
|
| 7 |
+
import json
|
| 8 |
+
import re
|
| 9 |
+
import struct
|
| 10 |
+
|
| 11 |
+
import numpy as np
|
| 12 |
+
import requests
|
| 13 |
+
from huggingface_hub import get_token, hf_hub_url
|
| 14 |
+
|
| 15 |
+
from . import hub
|
| 16 |
+
|
| 17 |
+
WEIGHT_EXT = (".safetensors", ".gguf", ".bin", ".pt", ".pth", ".ckpt", ".onnx", ".npz", ".sft")
|
| 18 |
+
MEDIA_VIDEO = (".mp4", ".webm", ".mov", ".gif", ".mkv")
|
| 19 |
+
MEDIA_IMAGE = (".png", ".jpg", ".jpeg", ".webp")
|
| 20 |
+
README_MAX = 12_000
|
| 21 |
+
|
| 22 |
+
_S = requests.Session()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _auth():
|
| 26 |
+
t = get_token()
|
| 27 |
+
return {"Authorization": f"Bearer {t}"} if t else {}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _range(repo, fname, start, end, kind="model", revision=None):
|
| 31 |
+
url = hf_hub_url(repo, fname, repo_type=None if kind == "model" else kind, revision=revision)
|
| 32 |
+
r = hub.retry(_S.get, url, headers={**_auth(), "Range": f"bytes={start}-{end}"}, timeout=60)
|
| 33 |
+
r.raise_for_status()
|
| 34 |
+
return r.content
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def st_header(repo, fname, revision=None):
|
| 38 |
+
n = struct.unpack("<Q", _range(repo, fname, 0, 7, revision=revision))[0]
|
| 39 |
+
if n > 50_000_000:
|
| 40 |
+
raise ValueError("header too large")
|
| 41 |
+
h = json.loads(_range(repo, fname, 8, 8 + n - 1, revision=revision))
|
| 42 |
+
return n, h
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
_DT = {"BF16": ("bf16", 2), "F16": (np.float16, 2), "F32": (np.float32, 4)}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def st_values(repo, fname, n_header, info, count=256, revision=None):
|
| 49 |
+
dt = info["dtype"]
|
| 50 |
+
if dt not in _DT:
|
| 51 |
+
return None
|
| 52 |
+
kind, size = _DT[dt]
|
| 53 |
+
start = 8 + n_header + info["data_offsets"][0]
|
| 54 |
+
raw = _range(repo, fname, start, start + count * size - 1, revision=revision)
|
| 55 |
+
if kind == "bf16":
|
| 56 |
+
u = np.frombuffer(raw, dtype=np.uint16).astype(np.uint32) << 16
|
| 57 |
+
return u.view(np.float32)
|
| 58 |
+
return np.frombuffer(raw, dtype=kind).astype(np.float32)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def gguf_header(repo, fname, limit=8_000_000):
|
| 62 |
+
"""Parse GGUF metadata + tensor names from the first `limit` bytes (best effort)."""
|
| 63 |
+
buf = _range(repo, fname, 0, limit - 1)
|
| 64 |
+
if buf[:4] != b"GGUF":
|
| 65 |
+
return None
|
| 66 |
+
p = 4
|
| 67 |
+
ver, = struct.unpack_from("<I", buf, p); p += 4
|
| 68 |
+
nt, nkv = struct.unpack_from("<QQ", buf, p); p += 16
|
| 69 |
+
out = {"version": ver, "n_tensors": nt, "kv": {}, "tensors": []}
|
| 70 |
+
sizes = {0: 1, 1: 1, 2: 2, 3: 2, 4: 4, 5: 4, 6: 4, 7: 1, 10: 8, 11: 8, 12: 8}
|
| 71 |
+
fmt = {0: "<B", 1: "<b", 2: "<H", 3: "<h", 4: "<I", 5: "<i", 6: "<f", 7: "<?", 10: "<Q", 11: "<q", 12: "<d"}
|
| 72 |
+
|
| 73 |
+
def rstr(p):
|
| 74 |
+
n, = struct.unpack_from("<Q", buf, p)
|
| 75 |
+
return buf[p + 8:p + 8 + n].decode("utf-8", "replace"), p + 8 + n
|
| 76 |
+
|
| 77 |
+
def rval(t, p):
|
| 78 |
+
if t == 8:
|
| 79 |
+
return rstr(p)
|
| 80 |
+
if t == 9:
|
| 81 |
+
at, n = struct.unpack_from("<IQ", buf, p); p += 12
|
| 82 |
+
if at == 8:
|
| 83 |
+
vals = []
|
| 84 |
+
for _ in range(n):
|
| 85 |
+
s, p = rstr(p)
|
| 86 |
+
if len(vals) < 4:
|
| 87 |
+
vals.append(s)
|
| 88 |
+
return vals, p
|
| 89 |
+
return None, p + sizes[at] * n
|
| 90 |
+
return struct.unpack_from(fmt[t], buf, p)[0], p + sizes[t]
|
| 91 |
+
try:
|
| 92 |
+
for _ in range(nkv):
|
| 93 |
+
k, p = rstr(p)
|
| 94 |
+
t, = struct.unpack_from("<I", buf, p); p += 4
|
| 95 |
+
v, p = rval(t, p)
|
| 96 |
+
if isinstance(v, (str, int, float, bool)) and len(str(v)) < 300:
|
| 97 |
+
out["kv"][k] = v
|
| 98 |
+
for _ in range(nt):
|
| 99 |
+
name, p = rstr(p)
|
| 100 |
+
nd, = struct.unpack_from("<I", buf, p); p += 4
|
| 101 |
+
dims = list(struct.unpack_from(f"<{nd}Q", buf, p)); p += 8 * nd + 4 + 8
|
| 102 |
+
out["tensors"].append(name)
|
| 103 |
+
out.setdefault("shapes", {})[name] = dims
|
| 104 |
+
except (struct.error, IndexError):
|
| 105 |
+
out["truncated"] = True
|
| 106 |
+
return out
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def _pick_weight(files):
|
| 110 |
+
"""Main weight file: prefer DiT / LoRA files over VAE, text encoder, embeddings."""
|
| 111 |
+
w = [f for f in files if f["name"].lower().endswith(WEIGHT_EXT)]
|
| 112 |
+
if not w:
|
| 113 |
+
return None
|
| 114 |
+
|
| 115 |
+
def score(f):
|
| 116 |
+
n = f["name"].lower()
|
| 117 |
+
s = f["size"] or 0
|
| 118 |
+
bad = any(x in n for x in ("vae", "text_encoder", "text_encoders/", "tokenizer", "embeddings/",
|
| 119 |
+
"clip", "t5", "qwen", "encoder", "tae", "upscal"))
|
| 120 |
+
return (0 if bad else 1, s)
|
| 121 |
+
return max(w, key=score)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def enrich_model(repo_id, fam):
|
| 125 |
+
i = hub.info("model", repo_id, files_metadata=True)
|
| 126 |
+
files = [{"name": s.rfilename, "size": s.size or 0,
|
| 127 |
+
"sha256": (s.lfs.sha256 if getattr(s, "lfs", None) else None)} for s in (i.siblings or [])]
|
| 128 |
+
ev = {"repo_id": repo_id, "sha": i.sha, "files": files, "config": _small(i.config),
|
| 129 |
+
"card": (i.card_data.to_dict() if i.card_data else {}), "errors": []}
|
| 130 |
+
names = [f["name"] for f in files]
|
| 131 |
+
lower = [n.lower() for n in names]
|
| 132 |
+
ev["n_weight_files"] = sum(n.endswith(WEIGHT_EXT) for n in lower)
|
| 133 |
+
ev["weight_bytes"] = sum(f["size"] for f in files if f["name"].lower().endswith(WEIGHT_EXT))
|
| 134 |
+
ev["has_video_media"] = any(n.endswith(MEDIA_VIDEO) for n in lower)
|
| 135 |
+
ev["has_image_media"] = any(n.endswith(MEDIA_IMAGE) for n in lower)
|
| 136 |
+
ev["has_adapter_config"] = any(n.endswith("adapter_config.json") for n in lower)
|
| 137 |
+
ev["has_gguf"] = any(n.endswith(".gguf") for n in lower)
|
| 138 |
+
|
| 139 |
+
for small in [n for n in names if n.endswith("model_index.json")][:1]:
|
| 140 |
+
try:
|
| 141 |
+
ev["model_index"] = _small(json.loads(_range(repo_id, small, 0, 200_000)))
|
| 142 |
+
except Exception as e:
|
| 143 |
+
ev["errors"].append(f"model_index: {e}")
|
| 144 |
+
if "README.md" in names:
|
| 145 |
+
try:
|
| 146 |
+
ev["readme"] = _range(repo_id, "README.md", 0, README_MAX).decode("utf-8", "replace")
|
| 147 |
+
except Exception as e:
|
| 148 |
+
ev["errors"].append(f"readme: {e}")
|
| 149 |
+
|
| 150 |
+
main = _pick_weight(files)
|
| 151 |
+
ev["main_weight"] = main["name"] if main else None
|
| 152 |
+
if main and main["name"].lower().endswith(".gguf"):
|
| 153 |
+
try:
|
| 154 |
+
g = gguf_header(repo_id, main["name"])
|
| 155 |
+
if g:
|
| 156 |
+
ev["gguf"] = {"kv": g["kv"], "n_tensors": g["n_tensors"],
|
| 157 |
+
"tensor_names": _summarise_keys(g["tensors"]), "truncated": g.get("truncated")}
|
| 158 |
+
ev["dit_sig"] = dit_signature(g.get("shapes", {}), fam)
|
| 159 |
+
except Exception as e:
|
| 160 |
+
ev["errors"].append(f"gguf: {e}")
|
| 161 |
+
elif main and main["name"].lower().endswith((".safetensors", ".sft")):
|
| 162 |
+
ev.update(_safetensors_evidence(repo_id, main["name"], files, fam))
|
| 163 |
+
if not ev.get("st_meta") or len(json.dumps(ev["st_meta"])) < 40:
|
| 164 |
+
ev["st_meta"] = {**_other_meta(repo_id, files, main["name"]), **(ev.get("st_meta") or {})}
|
| 165 |
+
return ev
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def _other_meta(repo_id, files, main_name, n=2):
|
| 169 |
+
"""Training metadata often sits in a sibling file (kohya/musubi output next to a
|
| 170 |
+
diffusers conversion), so read the headers of a couple of other safetensors."""
|
| 171 |
+
others = sorted([f for f in files if f["name"].lower().endswith(".safetensors") and f["name"] != main_name
|
| 172 |
+
and 0 < f["size"] < 10e9], key=lambda f: f["size"])[:n]
|
| 173 |
+
meta = {}
|
| 174 |
+
for f in others:
|
| 175 |
+
try:
|
| 176 |
+
_, h = st_header(repo_id, f["name"])
|
| 177 |
+
except Exception:
|
| 178 |
+
continue
|
| 179 |
+
for k, v in (h.get("__metadata__") or {}).items():
|
| 180 |
+
if k not in meta:
|
| 181 |
+
meta[k] = v if len(str(v)) < 600 else str(v)[:600]
|
| 182 |
+
return meta
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def _safetensors_evidence(repo_id, fname, files, fam):
|
| 186 |
+
out = {}
|
| 187 |
+
try:
|
| 188 |
+
n, h = st_header(repo_id, fname)
|
| 189 |
+
except Exception as e:
|
| 190 |
+
return {"errors": [f"st_header: {e}"]}
|
| 191 |
+
meta = h.pop("__metadata__", {}) or {}
|
| 192 |
+
keys = list(h.keys())
|
| 193 |
+
# Sharded checkpoints: the index lists every tensor name.
|
| 194 |
+
def folder(p):
|
| 195 |
+
return p.rsplit("/", 1)[0] if "/" in p else ""
|
| 196 |
+
idx = [f["name"] for f in files
|
| 197 |
+
if f["name"].endswith(".safetensors.index.json") and folder(f["name"]) == folder(fname)]
|
| 198 |
+
all_keys = keys
|
| 199 |
+
if idx:
|
| 200 |
+
try:
|
| 201 |
+
all_keys = list(json.loads(_range(repo_id, idx[0], 0, 20_000_000))["weight_map"].keys())
|
| 202 |
+
except Exception:
|
| 203 |
+
pass
|
| 204 |
+
dtypes = {}
|
| 205 |
+
for v in h.values():
|
| 206 |
+
dtypes[v["dtype"]] = dtypes.get(v["dtype"], 0) + 1
|
| 207 |
+
out["st_meta"] = {k: (v if len(str(v)) < 600 else str(v)[:600]) for k, v in meta.items()}
|
| 208 |
+
out["st_dtypes"] = dtypes
|
| 209 |
+
out["st_n_tensors"] = len(all_keys)
|
| 210 |
+
out["st_keys"] = _summarise_keys(all_keys)
|
| 211 |
+
out["dit_sig"] = dit_signature({k: v["shape"] for k, v in h.items()}, fam)
|
| 212 |
+
# Value probe on one block tensor, if this file holds it in a plain float dtype.
|
| 213 |
+
for pre in fam.probe_prefixes:
|
| 214 |
+
for pn in fam.probe_names:
|
| 215 |
+
k = pre + pn
|
| 216 |
+
if k in h and h[k]["dtype"] in _DT:
|
| 217 |
+
try:
|
| 218 |
+
v = st_values(repo_id, fname, n, h[k])
|
| 219 |
+
out["probe"] = {"key": pn, "dtype": h[k]["dtype"], "shape": h[k]["shape"],
|
| 220 |
+
"values": [float(x) for x in v]}
|
| 221 |
+
except Exception as e:
|
| 222 |
+
out.setdefault("errors", []).append(f"probe: {e}")
|
| 223 |
+
return out
|
| 224 |
+
return out
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def dit_signature(shapes, fam):
|
| 228 |
+
"""How many block-level tensors carry the family's characteristic sizes.
|
| 229 |
+
|
| 230 |
+
For H3 this separates the H3 / H3-Image DiT (hidden 5376) from Wan (5120), LTX (4096),
|
| 231 |
+
Flux/Hunyuan (3072) and from LLMs that also use 5376 (they name layers model.layers.N...).
|
| 232 |
+
It cannot tell members that share one shape apart; that is left to markers and probes.
|
| 233 |
+
"""
|
| 234 |
+
if not fam.sig_names or not fam.sig_dims:
|
| 235 |
+
return None
|
| 236 |
+
hit = tot = 0
|
| 237 |
+
for k, shp in shapes.items():
|
| 238 |
+
if not fam.sig_names.search(k):
|
| 239 |
+
continue
|
| 240 |
+
tot += 1
|
| 241 |
+
if any(d in fam.sig_dims for d in shp):
|
| 242 |
+
hit += 1
|
| 243 |
+
return {"block_tensors": tot, "sig_hits": hit}
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
def _summarise_keys(keys):
|
| 247 |
+
"""Keep what classification needs: marker keys and a de-duplicated key pattern sample."""
|
| 248 |
+
markers = [k for k in keys if re.search(r"audio|pdd|lora|lokr|loha|alpha|controlnet|control_|video_out|"
|
| 249 |
+
r"proj_out|patch_proj|final_layer", k, re.I)]
|
| 250 |
+
patterns = sorted({re.sub(r"\.\d+\.", ".N.", k) for k in keys})
|
| 251 |
+
return {"n": len(keys), "markers": markers[:60], "patterns": patterns[:120]}
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
def _small(x, limit=4000):
|
| 255 |
+
if x is None:
|
| 256 |
+
return None
|
| 257 |
+
s = json.dumps(x, default=str)
|
| 258 |
+
if len(s) <= limit:
|
| 259 |
+
return json.loads(s)
|
| 260 |
+
if isinstance(x, dict):
|
| 261 |
+
return {k: (v if len(json.dumps(v, default=str)) < 500 else "…") for k, v in x.items()}
|
| 262 |
+
return None
|
code/hfeco/families/__init__.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import h3
|
| 2 |
+
|
| 3 |
+
FAMILIES = {f.key: f for f in [h3.FAMILY]}
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def get(key):
|
| 7 |
+
return FAMILIES[key]
|
code/hfeco/families/h3.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""MiniMax-H3 family: H3 (video+audio), H3-Image (image, fine-tuned from H3), H3-Image-PE (text).
|
| 2 |
+
|
| 3 |
+
Facts these rules rely on (checked 2026-11-17 against the official repos):
|
| 4 |
+
- H3 and H3-Image share one DiT shape (hidden 5376, 50 blocks); tensor shapes alone cannot
|
| 5 |
+
separate them. Full weights can: H3 has an audio branch (audio_patch_proj, final_layer.audio_out
|
| 6 |
+
in the original/ComfyUI layout; audio_proj_in/out in diffusers), H3-Image has none and adds
|
| 7 |
+
PDD heads (pdd_proj_out.* in diffusers, pdd_steps in ComfyUI metadata).
|
| 8 |
+
- blocks.10.attn.out_proj.weight differs clearly between H3 and H3-Image, and is identical
|
| 9 |
+
between H3 and its ComfyUI repack, so a few hundred values tell repack / finetune / member.
|
| 10 |
+
- LoRAs only touch the shared blocks; their lineage comes from training metadata
|
| 11 |
+
(minimax_h3_fl2va / ref2va / text_to_video vs minimax_h3_image), the card, sample media
|
| 12 |
+
and the creation date.
|
| 13 |
+
- H3-Image-PE is a Qwen3.8-27B text model; Qwen3-VL-32B is H3's own text encoder.
|
| 14 |
+
"""
|
| 15 |
+
import re
|
| 16 |
+
|
| 17 |
+
from ..family import Family, Member
|
| 18 |
+
|
| 19 |
+
IMAGE_TEXT = re.compile(r"h3[-_ ]?image|h3image|minimax[-_ ]h3[-_ ]image", re.I)
|
| 20 |
+
PE_TEXT = re.compile(r"h3[-_ ]?image[-_ ]?pe\b|prompt[-_ ]?(enhanc|expan)|提示词扩写|\bPE\b")
|
| 21 |
+
VIDEO_TEXT = re.compile(r"text[-_ ]to[-_ ]video|image[-_ ]to[-_ ]video|\bt2v\b|\bi2v\b|\br2v\b|fl2va|ref2va|"
|
| 22 |
+
r"\bvideos?\b|frames?\b|fps\b|视频", re.I)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def full_dit_without_audio(ev, ctx):
|
| 26 |
+
"""A complete H3-shaped DiT with no audio branch and no PDD heads -> H3-Image layout."""
|
| 27 |
+
m = ctx["markers"]
|
| 28 |
+
if ctx["is_dit"] and not ctx["is_lora"] and ctx["sig"].get("block_tensors", 0) >= 200 \
|
| 29 |
+
and not re.search(r"audio", m) and not re.search(r"pdd", m) \
|
| 30 |
+
and re.search(r"video_out|proj_out|video_patch_proj", m):
|
| 31 |
+
return [("H3-Image", "完整 DiT 权重但没有音频分支,符合 H3-Image")]
|
| 32 |
+
return []
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
FAMILY = Family(
|
| 36 |
+
key="h3",
|
| 37 |
+
title="MiniMax-H3 家族",
|
| 38 |
+
members=[
|
| 39 |
+
Member("H3", "MiniMaxAI/MiniMax-H3", "video", None),
|
| 40 |
+
Member("H3-Image", "MiniMaxAI/MiniMax-H3-Image", "image", IMAGE_TEXT),
|
| 41 |
+
Member("H3-Image-PE", "MiniMaxAI/MiniMax-H3-Image-PE", "text", PE_TEXT),
|
| 42 |
+
],
|
| 43 |
+
default_member="H3",
|
| 44 |
+
name_queries=["h3", "hailuo"],
|
| 45 |
+
fulltext_queries=['"MiniMax-H3"', '"MiniMax H3"', '"minimax_h3"', '"H3-Image"', '"MiniMaxH3"'],
|
| 46 |
+
tag_filters=["minimax-h3"],
|
| 47 |
+
family_text=re.compile(r"minimax[-_ ]?h3|mm[-_ ]?h3|hailuo", re.I),
|
| 48 |
+
name_hint=re.compile(r"minimax|mm-?h3|hailuo|h3[-_ ]?image|(^|[^a-z0-9])h3([^a-z0-9]|$)", re.I),
|
| 49 |
+
sig_dims={5376, 21504, 96768},
|
| 50 |
+
sig_names=re.compile(r"(^|[._])(blocks|transformer_blocks|double_blocks|refiner_blocks)[._]\d+[._]"
|
| 51 |
+
r"(attn|ff|mlp|adaln|self_attn|cross_attn)"),
|
| 52 |
+
marker_rules=[
|
| 53 |
+
(re.compile(r"audio_patch_proj|audio_proj_in|audio_proj_out|audio_out\b|final_layer\.audio"), "H3",
|
| 54 |
+
"完整权重里有音频分支(audio_patch_proj / audio_out),只有 H3 有", True),
|
| 55 |
+
(re.compile(r"pdd_proj_out|pdd_head"), "H3-Image", "权重里有 PDD 头,只有 H3-Image 有", False),
|
| 56 |
+
],
|
| 57 |
+
meta_rules=[
|
| 58 |
+
(re.compile(r"pdd_steps"), "H3-Image", "文件头里有 PDD 配置,只有 H3-Image 有"),
|
| 59 |
+
(re.compile(r"h3[-_]?image|minimax_h3_image|minimaxh3image"), "H3-Image", "文件头的训练信息写明底模是 H3-Image"),
|
| 60 |
+
(re.compile(r"fl2va|ref2va|text_to_video|image_to_video|minimax[-_]h3"), "H3", "文件头的训练信息写明底模是 H3"),
|
| 61 |
+
],
|
| 62 |
+
index_rules=[("MiniMaxH3Image", "H3-Image"), ("MiniMaxH3", "H3")],
|
| 63 |
+
extra_structural=full_dit_without_audio,
|
| 64 |
+
probe_names=["blocks.10.attn.out_proj.weight", "transformer_blocks.10.attn.to_out.0.weight"],
|
| 65 |
+
probe_sources=[
|
| 66 |
+
("H3", "MiniMaxAI/MiniMax-H3", "FL2VA/transformer"),
|
| 67 |
+
("H3", "MiniMaxAI/MiniMax-H3", "Ref2VA/transformer"),
|
| 68 |
+
("H3", "MiniMaxAI/MiniMax-H3", "transformer"),
|
| 69 |
+
("H3", "MiniMaxAI/MiniMax-H3", "transformer_ref"),
|
| 70 |
+
("H3-Image", "MiniMaxAI/MiniMax-H3-Image", "transformer"),
|
| 71 |
+
("H3-Image", "MiniMaxAI/MiniMax-H3-Image", "transformer_diffusers"),
|
| 72 |
+
],
|
| 73 |
+
card_rules=[
|
| 74 |
+
(IMAGE_TEXT, "H3-Image", 4, "模型卡提到 H3-Image", False),
|
| 75 |
+
(VIDEO_TEXT, "H3", 2, "模型卡讲的是视频生成", True),
|
| 76 |
+
],
|
| 77 |
+
native_quant={"H3-Image-PE": re.compile(r"nvfp4|fp4|modelopt", re.I)}, # the official PE ships as NVFP4
|
| 78 |
+
text_member="H3-Image-PE",
|
| 79 |
+
text_member_hint=PE_TEXT,
|
| 80 |
+
text_component=re.compile(r"qwen3[-_.]?vl|text[-_ ]?encoder|conditioner", re.I),
|
| 81 |
+
component_names=re.compile(r"(^|[^a-z])(vae|tae|taeh3|text[-_ ]?encoder|conditioner|qwen3[-_.]?vl|"
|
| 82 |
+
r"upscal|latent[-_ ]upscal|audio[-_]vae|clip|tokenizer|embeddings?)([^a-z]|$)", re.I),
|
| 83 |
+
)
|
code/hfeco/families/h3_reference.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"sha256": {"37dddc2f3e6d5d5139d823d5ea283bbf304dadcb885b1ccda818aa13dade5ea2": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/audio_vae/model.safetensors", "size": 605429308}, "6b9dfbc930e505402ae9d7e5091a9d7d656cda5f34614f01cfe70bfb0cca27cb": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00001-of-00014.safetensors", "size": 4932328944}, "d8bb44b4ff303fe76fe9e894022fb3dc71b15a2e716592790fe0e3c3e60478fa": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00002-of-00014.safetensors", "size": 4875990528}, "54f22e8b3168f8dc962fac0d313607ebf52a12b433d4cf3098a0d82d9f042940": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00003-of-00014.safetensors", "size": 4875990552}, "ad09c74d3c13ee29b5d0d84548fd8a3424a651564eaccd519946c296e59c557f": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00004-of-00014.safetensors", "size": 4875990584}, "fc993c8a0e2a5b0570f383e1a95dc3a1281d1b224b6f3ee908f4827941e1dfc2": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00005-of-00014.safetensors", "size": 4875990584}, "82f05620d1f718a90c362b221d6a184ff1a0f53301d706882d3df49695fa1974": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00006-of-00014.safetensors", "size": 4875990584}, "fb91da8cb01ff4de3eef0eab1c3e769a734b3a1aafc61734068638a0d6c86934": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00007-of-00014.safetensors", "size": 4875990584}, "431ca56535c8781944ce3801f5eb61c45531e853ecc5846d936ebaf4761b764f": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00008-of-00014.safetensors", "size": 4875990584}, "3825e3f4302f4d2f7d76aa7430d2ce0864fde6b9e540a5806bf0d8e38e4d9f47": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00009-of-00014.safetensors", "size": 4875990584}, "aded5a4d1d5e22dbd8b6f79266b6eb88c840411b09527c53917a1419ace22e2f": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00010-of-00014.safetensors", "size": 4875990584}, "3820ffe8d8d6477f6fe8d614ef3c87abb264ee39accebf43a1507b970d80946f": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00011-of-00014.safetensors", "size": 4875990584}, "05ad2d08ce71963121c9b03f1d9ec5d7641052f4b23c6c12b80d71065eb8e98e": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00012-of-00014.safetensors", "size": 4875990584}, "b64f2289871261fdd1abbd3b78bcd66011b341de3dc8eeb2ed1a473ee7c8d95c": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00013-of-00014.safetensors", "size": 4875990584}, "e45b6c9998c77ee5a6577f9f47bc76416c1d4d387169e50c4c9d3134ea51b13b": {"lineages": ["H3", "H3-Image"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/text_encoder/model-00014-of-00014.safetensors", "size": 3270697008}, "0b3386565e476bfdea287e9ea9f269d036e5c649ed14bb9b4afac1dc4661bd2a": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00001-of-00013.safetensors", "size": 5227812968}, "9c98fd4579c9bc96d1b1bbf65c1243f9256df60bccd229570cecc61897773003": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00002-of-00013.safetensors", "size": 5164578856}, "fa484c940d4170199fb69f5016739df2daf6ecd1150631b12a297e06e3964730": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00003-of-00013.safetensors", "size": 5164578872}, "4a851df37cce2d14b39cb58df41def7b591b1f11b8520a32b421a5fa3e997c9f": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00004-of-00013.safetensors", "size": 5164578896}, "3fe6ff94dc9d3107c6776a25277d2b72b5443f88cf0f4ed835fd5b65a94ea5d4": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00005-of-00013.safetensors", "size": 5164578896}, "79b47e1b9ff03a2c6f06dd15a28972acf32c0867172ee34e5aa6e96b99494127": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00006-of-00013.safetensors", "size": 5164578896}, "6ac4d6ce639786b722a8dd99843ed56dcab48a0d174a4b0f9b8cdcbe5160fb0f": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00007-of-00013.safetensors", "size": 5164578896}, "03531812243fb0a333e01efa7e3d39750580bca8cbf2ba0529da419278eab736": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00008-of-00013.safetensors", "size": 5164578896}, "7e82a80b0d0d267026eb841b81523069cc7b956c1ebd8a18c07e462ffb262487": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00009-of-00013.safetensors", "size": 5164578896}, "ef0a1f6b65145232543dd2232d58d91a4d31f44b0da5084acf22cea123255481": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00010-of-00013.safetensors", "size": 5164578896}, "bf885b8f2f078c5499b75fded21094a26bfe0e6e00bee276e499443ecd2f298d": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00011-of-00013.safetensors", "size": 5164578896}, "dc717572d014ebf8527e35af815d10eb2f5a6bc87253b8a7d2f456965192db69": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00012-of-00013.safetensors", "size": 5164578896}, "8bfd852d5817e9836de1d3ec8dbac1c5446b167568b717371f08282b22291aa2": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/transformer/model-00013-of-00013.safetensors", "size": 4242305176}, "5f0c2e161d895a9fee7645ca32d4a7e3a22b90cacfcbeba62ec999cdbbefe0d3": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/FL2VA/video_vae/source/model.safetensors", "size": 10415548320}, "902d6ae787f6d394d0104c1ef3ce19528209715fd5b0292f09d4ef7ca19c8504": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00001-of-00013.safetensors", "size": 5227812968}, "97b907e4d9b3ba533c820827ab4a03ec0d6be2a5cb8925a7e570de849ea8b183": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00002-of-00013.safetensors", "size": 5164578856}, "fbdf425e351622103419d8f1ddf50f2515917235588849afb365967615141f55": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00003-of-00013.safetensors", "size": 5164578872}, "3831e9ff2640a93e3601d957c81640cc6ba7aa317dc7eae1d6ac3e2428767db3": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00004-of-00013.safetensors", "size": 5164578896}, "ec7c6bdd26985a7ac6c83a563d5d4ad6fd961c51a2e5eeabeaaa3b45b6053e1a": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00005-of-00013.safetensors", "size": 5164578896}, "536c4fe01ffdeaca8f28d8df8c53cd7deb62942ec630aa1f058d0423db4438a7": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00006-of-00013.safetensors", "size": 5164578896}, "c7b80189722b211af43bf04066ea98ef5ca5bc4f1f13d3b06444d4c30aafead7": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00007-of-00013.safetensors", "size": 5164578896}, "1a7da8bb7477d27cfcc03bd7ff81b3be015411e74006da6e542ce4ce32f7ecb4": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00008-of-00013.safetensors", "size": 5164578896}, "33f44f03128b6d47e3c17a12d3d6f9c67a06b2facdb18a7f2b2121312ba43909": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00009-of-00013.safetensors", "size": 5164578896}, "adb8df74dcffebed919e15ca1e99f6a21f738ac3dbcb111f27168d9b1f03a304": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00010-of-00013.safetensors", "size": 5164578896}, "7175cdde6953c234ba0f518e81628ae4ed97790e1eaadabaf1783bddba030c90": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00011-of-00013.safetensors", "size": 5164578896}, "1c5c0bf33ab63e018e5923afaa8ce0dbb0feb07dbda1671605b11b99192450b6": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00012-of-00013.safetensors", "size": 5164578896}, "572e060b9b727bba6ee6c639e988d74978adfbf94f8bac9aa8e7f5bde88c1ec7": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer/model-00013-of-00013.safetensors", "size": 4242305176}, "5a5d6e0fcdda7e6a5d98cb92d9e5cb4b6b0b44d6e1dfd5a370d16dfaa79b9ae6": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/fl2va.mp4", "size": 1064614}, "cc928dc5f406ca22d66656f98717808fd16ede2bfb5a3483c9b71264a9d74678": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/h3_direct_2k.mp4", "size": 8946498}, "642e444e8cfa9d3417da69f429598d067bb8123639bbbe462de5687b583ac641": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/h3_direct_768p.mp4", "size": 2385173}, "dcfec002e432208a9feeeb90b7867a00c1d6a18ce4707fa94df0930997802840": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/i2va_2k.mp4", "size": 3334690}, "c3c1eef07982164c7be26a2c8286c14a3f3d15afca94006856d3501873cc7fed": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/i2va_direct_2k.mp4", "size": 4569735}, "fc73d7633bed7f0125b9219ae97e9f7c75c26176aae82bbb4c5d1576187d96f1": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/i2va_direct_768p.mp4", "size": 1448158}, "c3c96ce2bcd22b61ca65974c1a071b1659398644416cae2609f1ba026bd3ce35": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/r2va_2k.mp4", "size": 2788329}, "26f07ac79f8731360790ae1f046ab9d78ba0b3ba5fe84f61578696856bbec993": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/r2va_direct_2k.mp4", "size": 3134612}, "9b940b139d164be8b4cf310143869b2f85054808d0d496ea7de62e848d8a2445": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/r2va_direct_768p.mp4", "size": 1121153}, "d66903241362e224085cc93f7a5e70fba6ab378d0ac6ff6af83acf2559849a42": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/t2va.mp4", "size": 1637373}, "6624095cbda8953606b39a763b7988bd2c183e0469e2e3c3e1be2eba5a022023": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/assets/t2va_2k.mp4", "size": 6000926}, "52c59e67ba8de5477c81bfbced0327aabf500f1bfdeefd5ee754529241cb26cb": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/audio_vae/diffusion_pytorch_model.safetensors", "size": 605429340}, "2d847200c45c09dd7f973c1b096663068408ef851ee0b3711d059b6dc5dcd028": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00001-of-00014.safetensors", "size": 4825958704}, "2c4d362eddd2802180ac9c744849eb9ba8d9c8b984bdf9822cb02ed004b29184": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00002-of-00014.safetensors", "size": 4702158032}, "949c5aafbbfa5654da730a6a7fafd75adb164d0857b095a30e8bb6d390887d69": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00003-of-00014.safetensors", "size": 4933368192}, "eef7616790105ee839766bb2027203bf2c0d87c6aa038dca84145a8675f5ce28": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00004-of-00014.safetensors", "size": 4567069608}, "43fdf42d638e8bc6745f713fae80c93bb301807a1a5ae7249344ce28e202a494": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00005-of-00014.safetensors", "size": 4702158080}, "6442510b34d173653f0cce5c964b935395a8f7accf0b9cc0aa31aec59805239d": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00006-of-00014.safetensors", "size": 4933368232}, "29f48f535c91dac76496ca821eeb16ca24bc4caf3f0cae8b920a89b1f966da6d": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00007-of-00014.safetensors", "size": 4567069608}, "c711b096c764bd60f0b8b6ad49518bfab6d614fb788c725add8741c0674a4cd8": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00008-of-00014.safetensors", "size": 4702158080}, "44428defe3976cbb87635ad200b958199e739986697cd29fdf27aeb7294b5944": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00009-of-00014.safetensors", "size": 4933368232}, "3d44939c374c9da382e9c6877e1946adf7b84e08c7a881c068f228d6849411c9": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00010-of-00014.safetensors", "size": 4567069608}, "224d24430b58127a5577721084e0e704a0e74ec96dd7c35bc6fc0994ebd87c33": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00011-of-00014.safetensors", "size": 4702158080}, "48fa2bd8fe134eef565ab2464f1c2589a6657cba0d14283dfc06b532f8961f3c": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00012-of-00014.safetensors", "size": 4933368232}, "be5b4b1809f9d546ffd4b3fcf41e5c1e02b819125caa6bc105c109b04c051bd3": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00013-of-00014.safetensors", "size": 4567069608}, "8fbd5e6c1fb1df7ce988ca90f3d59e7610e465c7517e4b344eda4a214ba4b97d": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer/diffusion_pytorch_model-00014-of-00014.safetensors", "size": 4644161920}, "7a3fcad885f51560e550b2e84c9a8d8b35e62996cfd9076937e992bd23478df9": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00001-of-00014.safetensors", "size": 4825958704}, "1638ae1dc8ae26c4ba43ad28a6d851ad8983847324bb2b468719c7c81f219706": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00002-of-00014.safetensors", "size": 4702158032}, "1ef3c4954ffe5a664c2e3028e2a3241190d9c159dce6ba1136002c6af1db5353": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00003-of-00014.safetensors", "size": 4933368192}, "12d92f2975cfd5c5b786126385c52e5bf64884d4b4d6e60c3ef5d857c3f7469f": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00004-of-00014.safetensors", "size": 4567069608}, "304d41ce03d59ac94bceb055935bf4e034df0badf8b0df4ded327c08a288a4cc": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00005-of-00014.safetensors", "size": 4702158080}, "12a134b7c76d86edbe8fa2dc315f6cdaf4e1aca1b6ea4dfe4cad92df03d42eeb": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00006-of-00014.safetensors", "size": 4933368232}, "b96395261359937c00fb42f4eb29306dc59b1a3368eeba52af4fb66e3e142c69": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00007-of-00014.safetensors", "size": 4567069608}, "1897a6bf3b4fc834bb82d73ca02a7afc7d38c07f50ec5382cd54cd2f91b604d1": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00008-of-00014.safetensors", "size": 4702158080}, "edfb38235adc96b99f55a401849befce59075a745e99c2d8c63ff358dd36443d": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00009-of-00014.safetensors", "size": 4933368232}, "f8710775cf3413670edd7e23861b650a3431a71a6cc14cb1080623ab6b052385": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00010-of-00014.safetensors", "size": 4567069608}, "9e18acc09f84edb5b34df9628efa15cfcab8bb76e8e20c1c2e979a107a0f7215": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00011-of-00014.safetensors", "size": 4702158080}, "ea2e18228f8bdba1a4e0f32b155e4586df055997c45356213d05b971ba13e2f4": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00012-of-00014.safetensors", "size": 4933368232}, "1e12083b1875678f7414ff55b09cd8bb1c30b861243f9bb7ff1e75b6ad3f1bdc": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00013-of-00014.safetensors", "size": 4567069608}, "b340f44b5690cc745d48ae399381ec15b26a4fe25d483f677ccb4960dadb50d4": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/transformer_ref/diffusion_pytorch_model-00014-of-00014.safetensors", "size": 4644161920}, "72f4c6be84ac0674f27398cde991dd9d719762f3952c4921aa66b2ce542f6374": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/vae/diffusion_pytorch_model-00001-of-00003.safetensors", "size": 5061033024}, "2e05e8bc23fa4071043e17fd242be8acd0685e781a43987432b2eae925be4198": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/vae/diffusion_pytorch_model-00002-of-00003.safetensors", "size": 4955986528}, "c05d6ac4b1a33de372799d708531da6320f6a3ce6d1ce6d895e770988e004a39": {"lineages": ["H3"], "file": "MiniMaxAI/MiniMax-H3/vae/diffusion_pytorch_model-00003-of-00003.safetensors", "size": 398539336}, "f915c291bfa6b80aa34204ff14ad3ed447e3c8a4aec9240ddb300676030f1260": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/assets/showcase/edit_map.jpg", "size": 1118914}, "100511a798fdc7f1e642dfc10e412bd66481999e0430dacfcc2f1317379d9840": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/assets/showcase/scene.jpg", "size": 1393763}, "fbcb0a3292548856d4906dfd7b22a7608da8d118357ae07ae417a9931dfcc8c7": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/assets/showcase_hero.jpg", "size": 1256299}, "7c74a3b8ae85e3bfbf78e9cbc91c76e9fa044a4fee81e4d100b019710ebbfdf0": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/assets/workflow_t2i.jpg", "size": 1370295}, "e3ef31ce2bf5f9a6f45c13f65b4728a87cc767cbcc8f0313aa1a4c8014dae85d": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/examples/reference1.png", "size": 1715003}, "c07093a098e3bef4d43cd29c33e239a0c45424c5ff40dfcc864df00b8d664738": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/pdd_fused_heads.safetensors", "size": 12388808}, "200667b632a6004bb8442008c4a8e975d64a7dbbc3d5569ed482650c3d61ff7b": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00001-of-00012.safetensors", "size": 5441123104}, "2227018562b2d92db391bce2fe641ea7f887585b581d6a73092a8fcfc59ef348": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00002-of-00012.safetensors", "size": 5839159856}, "165469f7dccbb9fb6cbdc7a88e89d2a0220697af4da7ee40a96b369ccfa5abc9": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00003-of-00012.safetensors", "size": 5472861152}, "2bf7dff80d49203cee29834ce6bd86077b09c4b73174d1c4f696f8fecab83ed3": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00004-of-00012.safetensors", "size": 5472860360}, "dcc7c79d46fa1ca910396fa001657985057db491af1bfadeda4cf3a82da329f2": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00005-of-00012.safetensors", "size": 5839159904}, "12c76e39604f04d11d282172719bad6ad374e98479b8892f4ea0c9d2695b3086": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00006-of-00012.safetensors", "size": 5472861168}, "59ed575a374c0304da09beb234225c17b5ecc1e491b76f72455f0b3b7a1fbbff": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00007-of-00012.safetensors", "size": 5472860360}, "b71af5f2f42fee2530b4154caba6ce595ce98072d831090a6b63a546420c0072": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00008-of-00012.safetensors", "size": 5839159904}, "a2764f44f306f6eecfd3d52567bcebe64ddfafb0a2fbdaf089efc1e74cbe82f8": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00009-of-00012.safetensors", "size": 5472861168}, "0e82a47b5fd0498674718c7a0b3830d042d349f6b5fe16cd2b35cccca5063365": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00010-of-00012.safetensors", "size": 5472860360}, "d728554ce210b10062e70db51080d2f6d6e41c6d0fa033dc77b021db20745d2b": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00011-of-00012.safetensors", "size": 5839159904}, "8d9e1c67066a5fa646f2e87f0868f73cb50be66cc1739e51eb12791fd9123b83": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer/model-00012-of-00012.safetensors", "size": 4644160496}, "acb9c4df2881b529aeb18ef2c13be62a19bf20792ef067f637ae5bcac17a6766": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00001-of-00012.safetensors", "size": 5436941096}, "20600886fede3ee00b82b8f7f344528a4e774a8c16271e8ec5b63de9408ba3bc": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00002-of-00012.safetensors", "size": 5841279952}, "883a6641265a84a047b1489812e1596aa3e8ab58e14473613a806dafe129ff20": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00003-of-00012.safetensors", "size": 5472841128}, "472b99ea4f2ff9438458c51ca90ba971056a35035bb50eaade8b5ecc502d87a8": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00004-of-00012.safetensors", "size": 5472883512}, "bb4f48e6bb159cbf38852c95ee062688c0c6de2e72f873d545d6b5430dc5cef8": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00005-of-00012.safetensors", "size": 5839161384}, "f347869ee1f1f9ba2649f8eae5833cdecae4c683b8ef11ffa4d9315eeae2b1ad": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00006-of-00012.safetensors", "size": 5472862856}, "b7c12409e0f6a7f308491e780fb116dca104549ae1f9b823de0391d4850fa273": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00007-of-00012.safetensors", "size": 5472861800}, "00b658c99072db8c72e423a4484646d3f9d8d32d6a6ebf143fd4ea0d281dc0e2": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00008-of-00012.safetensors", "size": 5839161384}, "4193119f57bd7467c32e834f632efc515535110fc39abc23ee10a98129eabd64": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00009-of-00012.safetensors", "size": 5472862856}, "6935231d3ed470c99409912b6ef1c8986eb69ed8a1b61c0da7e198649841bd00": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00010-of-00012.safetensors", "size": 5472861800}, "5f9927066a8adadfb6f50d73e0c3c96080d1be5f8fdba052ed29351c9d88cbde": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00011-of-00012.safetensors", "size": 5839161384}, "aa9e750dadffb82781d2b239869f85950b42c9d1322b402025541686f1c2a729": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers/diffusion_pytorch_model-00012-of-00012.safetensors", "size": 4656551424}, "a7c8bb1e181865e7cf87c29d3d6bc728d944ce4862b92d0e1cbdcc36b3b180b2": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/vae/diffusion_pytorch_model.safetensors", "size": 2336964672}, "5bb2809698c3989033f719ece2243f277fefedef1dd9a1d05f3d4136b2f93b35": {"lineages": ["H3-Image"], "file": "MiniMaxAI/MiniMax-H3-Image/vae_diffusers/diffusion_pytorch_model.safetensors", "size": 2336973400}, "aa1e601a201bda8d8b3d70c95f03a728e645e373242c51a46937bacb2387f41a": {"lineages": ["H3-Image-PE"], "file": "MiniMaxAI/MiniMax-H3-Image-PE/model-00001-of-00004.safetensors", "size": 4976117204}, "8cfb1eb9706a69e35e8ef24f24bf337a5be5119401c9f725f6a6726a2222b632": {"lineages": ["H3-Image-PE"], "file": "MiniMaxAI/MiniMax-H3-Image-PE/model-00002-of-00004.safetensors", "size": 4990902864}, "27bc4c3b16271aa5d159256d4f3ada1dbdf74bed07bad0d39843cf308d2a0822": {"lineages": ["H3-Image-PE"], "file": "MiniMaxAI/MiniMax-H3-Image-PE/model-00003-of-00004.safetensors", "size": 4995248056}, "2f181cb7b1789a20078e3f17f7717dbdc9a1952b08ce9d382656cf28eb62918c": {"lineages": ["H3-Image-PE"], "file": "MiniMaxAI/MiniMax-H3-Image-PE/model-00004-of-00004.safetensors", "size": 2953855884}, "06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523": {"lineages": ["H3-Image-PE"], "file": "MiniMaxAI/MiniMax-H3-Image-PE/tokenizer.json", "size": 19989325}}, "probes": [{"lineage": "H3", "source": "MiniMaxAI/MiniMax-H3/FL2VA/transformer", "key": "blocks.10.attn.out_proj.weight", "dtype": "BF16", "values": [0.01025390625, 0.07177734375, -0.1298828125, -0.01806640625, -0.0439453125, 0.0830078125, -0.01031494140625, 0.2578125, 0.22265625, 0.208984375, -0.07666015625, -0.0830078125, -0.1689453125, -0.095703125, -0.0230712890625, -0.042236328125, 0.2275390625, -0.05126953125, 0.06591796875, -0.095703125, 0.034423828125, -0.23046875, 0.059814453125, -0.16015625, -0.1787109375, 0.052001953125, 0.09765625, 0.203125, -0.0050048828125, -0.08740234375, -0.1669921875, 0.030029296875, 0.171875, -0.026123046875, 0.1201171875, 0.11181640625, -0.048828125, 0.177734375, 0.00537109375, -0.07763671875, -0.027099609375, 0.051513671875, -0.05322265625, -0.04443359375, 0.036376953125, 0.185546875, 0.1181640625, 0.12158203125, -0.166015625, -0.03466796875, -0.08154296875, -0.0086669921875, -0.0289306640625, -0.09033203125, -0.1748046875, 0.119140625, 0.1728515625, 0.2373046875, 0.007354736328125, -0.0732421875, -0.1162109375, 0.1630859375, 0.052490234375, -0.162109375, -0.134765625, 0.0595703125, 0.0791015625, -0.1083984375, 0.00390625, -0.220703125, 0.1826171875, -0.072265625, -0.1328125, -0.29296875, -0.005401611328125, -0.078125, -0.016357421875, 0.146484375, -0.2099609375, -0.0986328125, -0.09521484375, -0.09619140625, 0.1689453125, -0.031005859375, 0.0191650390625, 0.09326171875, -0.04443359375, 0.0022125244140625, -0.01019287109375, 0.08740234375, 0.08447265625, 0.012451171875, -0.271484375, 0.043212890625, -0.0703125, 0.083984375, -0.05078125, 0.0303955078125, 0.07373046875, -0.038330078125, -0.10986328125, -0.2294921875, -0.0888671875, -0.1455078125, -0.15234375, -0.0478515625, -0.0037078857421875, -0.0390625, 0.020751953125, 0.1201171875, 0.051025390625, -0.1279296875, 0.003509521484375, 0.216796875, 0.052490234375, 0.11767578125, -0.150390625, -0.023193359375, 0.04541015625, -0.1806640625, 0.010009765625, 0.1025390625, 0.09130859375, 0.197265625, -0.09228515625, 0.0380859375, 0.02880859375, 0.1298828125, -0.0947265625, 0.00151824951171875, -0.08203125, -0.11865234375, -0.1259765625, 0.1220703125, 0.134765625, -0.08642578125, 0.1875, 0.283203125, 0.1142578125, -0.09130859375, -0.251953125, -0.006378173828125, 0.02880859375, 0.11474609375, -0.0927734375, -0.05859375, 0.1689453125, 0.37109375, -0.1728515625, -0.01324462890625, -0.01519775390625, -0.010009765625, 0.08203125, -0.0185546875, -0.0751953125, 0.0228271484375, 0.0791015625, 0.259765625, -0.095703125, -0.1669921875, 0.123046875, -0.00860595703125, -0.1513671875, 0.059326171875, 0.193359375, 0.047607421875, 0.1640625, -0.26171875, -0.0634765625, -0.1259765625, 0.07080078125, -0.119140625, 0.19921875, -0.00982666015625, -0.0216064453125, 0.166015625, -0.2109375, 0.224609375, 0.09814453125, 0.265625, -0.083984375, -0.01806640625, 0.1337890625, -0.0106201171875, -0.04443359375, -0.035888671875, 0.062255859375, 0.12060546875, -0.083984375, 0.134765625, 0.11376953125, -0.0908203125, 0.24609375, 0.107421875, 0.138671875, 0.0125732421875, 0.011474609375, 0.0157470703125, -0.10986328125, 0.0308837890625, -0.087890625, -0.00921630859375, -0.19921875, 0.1787109375, -0.17578125, -0.1474609375, 0.016357421875, 0.058837890625, -0.0576171875, -0.09814453125, 0.1201171875, -0.004364013671875, 0.055419921875, 0.1494140625, 0.3515625, 0.10888671875, 0.203125, 0.11083984375, 0.014892578125, 0.095703125, 0.031005859375, 0.119140625, 0.0966796875, -0.306640625, -0.018310546875, 0.08984375, 0.09765625, -0.0517578125, -0.030029296875, -0.0244140625, 0.00390625, 0.00191497802734375, 0.189453125, -0.1728515625, -0.1533203125, 0.1669921875, 0.038330078125, -0.2236328125, 0.06005859375, -0.1953125, -0.1435546875, 0.29296875, -0.080078125, 0.0830078125, 0.05908203125, 0.0225830078125, -0.028076171875, 0.1591796875, 0.0238037109375, 0.080078125, -0.058837890625, -0.037841796875, 0.154296875, 0.19921875, -0.0196533203125, 0.0556640625]}, {"lineage": "H3", "source": "MiniMaxAI/MiniMax-H3/Ref2VA/transformer", "key": "blocks.10.attn.out_proj.weight", "dtype": "BF16", "values": [0.01171875, 0.0732421875, -0.1259765625, -0.0196533203125, -0.044189453125, 0.08642578125, -0.0098876953125, 0.2578125, 0.2197265625, 0.20703125, -0.07275390625, -0.08251953125, -0.169921875, -0.10595703125, -0.02392578125, -0.03564453125, 0.2275390625, -0.05224609375, 0.06103515625, -0.10009765625, 0.03515625, -0.2275390625, 0.05908203125, -0.1640625, -0.1806640625, 0.052734375, 0.0966796875, 0.2021484375, -0.0068359375, -0.0908203125, -0.16796875, 0.026611328125, 0.169921875, -0.031494140625, 0.1220703125, 0.11083984375, -0.05078125, 0.177734375, 0.0013580322265625, -0.078125, -0.0279541015625, 0.04638671875, -0.0556640625, -0.04541015625, 0.035400390625, 0.1865234375, 0.11767578125, 0.11962890625, -0.1630859375, -0.0322265625, -0.0859375, -0.00787353515625, -0.0286865234375, -0.09228515625, -0.1806640625, 0.12158203125, 0.1767578125, 0.236328125, 0.008544921875, -0.0712890625, -0.1181640625, 0.1640625, 0.052734375, -0.1630859375, -0.1318359375, 0.052978515625, 0.0751953125, -0.11083984375, 0.00860595703125, -0.220703125, 0.1845703125, -0.07275390625, -0.125, -0.29296875, -0.00457763671875, -0.08056640625, -0.0220947265625, 0.1484375, -0.2109375, -0.09814453125, -0.09912109375, -0.09130859375, 0.1748046875, -0.01904296875, 0.0220947265625, 0.087890625, -0.04345703125, 0.005157470703125, -0.0107421875, 0.09375, 0.0888671875, 0.010986328125, -0.267578125, 0.0458984375, -0.0703125, 0.083984375, -0.050537109375, 0.031005859375, 0.072265625, -0.037109375, -0.1103515625, -0.234375, -0.0908203125, -0.15234375, -0.1484375, -0.0458984375, -0.00421142578125, -0.03271484375, 0.0203857421875, 0.1171875, 0.05078125, -0.134765625, 0.0048828125, 0.2158203125, 0.05078125, 0.12158203125, -0.1513671875, -0.026123046875, 0.04296875, -0.1826171875, 0.00860595703125, 0.10302734375, 0.0888671875, 0.197265625, -0.09326171875, 0.037109375, 0.031982421875, 0.12890625, -0.09326171875, -0.0031890869140625, -0.07861328125, -0.1201171875, -0.1298828125, 0.126953125, 0.1376953125, -0.08056640625, 0.1845703125, 0.275390625, 0.10986328125, -0.09130859375, -0.255859375, -0.00787353515625, 0.0244140625, 0.12060546875, -0.08984375, -0.055419921875, 0.166015625, 0.376953125, -0.16796875, -0.01239013671875, -0.0201416015625, -0.006561279296875, 0.0830078125, -0.01153564453125, -0.0751953125, 0.0242919921875, 0.0888671875, 0.2578125, -0.09912109375, -0.1650390625, 0.12060546875, -0.005767822265625, -0.1484375, 0.05810546875, 0.1904296875, 0.04833984375, 0.166015625, -0.259765625, -0.0654296875, -0.12890625, 0.07177734375, -0.11376953125, 0.19921875, -0.01361083984375, -0.017333984375, 0.1640625, -0.2109375, 0.2197265625, 0.09130859375, 0.267578125, -0.08837890625, -0.0269775390625, 0.1357421875, -0.01336669921875, -0.0400390625, -0.037353515625, 0.061767578125, 0.125, -0.08154296875, 0.134765625, 0.10693359375, -0.08837890625, 0.251953125, 0.1083984375, 0.130859375, 0.01226806640625, 0.0089111328125, 0.0181884765625, -0.11279296875, 0.0341796875, -0.08935546875, -0.01226806640625, -0.1982421875, 0.1806640625, -0.1875, -0.1337890625, 0.0179443359375, 0.061279296875, -0.052001953125, -0.10205078125, 0.11767578125, -0.006866455078125, 0.06298828125, 0.154296875, 0.35546875, 0.11376953125, 0.20703125, 0.11181640625, 0.0205078125, 0.09326171875, 0.0289306640625, 0.11767578125, 0.0927734375, -0.306640625, -0.01904296875, 0.08984375, 0.09765625, -0.053466796875, -0.0238037109375, -0.0205078125, 0.006011962890625, 0.003570556640625, 0.1884765625, -0.1689453125, -0.1552734375, 0.166015625, 0.03857421875, -0.220703125, 0.0634765625, -0.1982421875, -0.1416015625, 0.2890625, -0.08935546875, 0.076171875, 0.061767578125, 0.03271484375, -0.017822265625, 0.154296875, 0.016845703125, 0.07861328125, -0.056396484375, -0.043701171875, 0.154296875, 0.193359375, -0.015625, 0.048828125]}, {"lineage": "H3", "source": "MiniMaxAI/MiniMax-H3/transformer", "key": "transformer_blocks.10.attn.to_out.0.weight", "dtype": "BF16", "values": [0.01025390625, 0.07177734375, -0.1298828125, -0.01806640625, -0.0439453125, 0.0830078125, -0.01031494140625, 0.2578125, 0.22265625, 0.208984375, -0.07666015625, -0.0830078125, -0.1689453125, -0.095703125, -0.0230712890625, -0.042236328125, 0.2275390625, -0.05126953125, 0.06591796875, -0.095703125, 0.034423828125, -0.23046875, 0.059814453125, -0.16015625, -0.1787109375, 0.052001953125, 0.09765625, 0.203125, -0.0050048828125, -0.08740234375, -0.1669921875, 0.030029296875, 0.171875, -0.026123046875, 0.1201171875, 0.11181640625, -0.048828125, 0.177734375, 0.00537109375, -0.07763671875, -0.027099609375, 0.051513671875, -0.05322265625, -0.04443359375, 0.036376953125, 0.185546875, 0.1181640625, 0.12158203125, -0.166015625, -0.03466796875, -0.08154296875, -0.0086669921875, -0.0289306640625, -0.09033203125, -0.1748046875, 0.119140625, 0.1728515625, 0.2373046875, 0.007354736328125, -0.0732421875, -0.1162109375, 0.1630859375, 0.052490234375, -0.162109375, -0.134765625, 0.0595703125, 0.0791015625, -0.1083984375, 0.00390625, -0.220703125, 0.1826171875, -0.072265625, -0.1328125, -0.29296875, -0.005401611328125, -0.078125, -0.016357421875, 0.146484375, -0.2099609375, -0.0986328125, -0.09521484375, -0.09619140625, 0.1689453125, -0.031005859375, 0.0191650390625, 0.09326171875, -0.04443359375, 0.0022125244140625, -0.01019287109375, 0.08740234375, 0.08447265625, 0.012451171875, -0.271484375, 0.043212890625, -0.0703125, 0.083984375, -0.05078125, 0.0303955078125, 0.07373046875, -0.038330078125, -0.10986328125, -0.2294921875, -0.0888671875, -0.1455078125, -0.15234375, -0.0478515625, -0.0037078857421875, -0.0390625, 0.020751953125, 0.1201171875, 0.051025390625, -0.1279296875, 0.003509521484375, 0.216796875, 0.052490234375, 0.11767578125, -0.150390625, -0.023193359375, 0.04541015625, -0.1806640625, 0.010009765625, 0.1025390625, 0.09130859375, 0.197265625, -0.09228515625, 0.0380859375, 0.02880859375, 0.1298828125, -0.0947265625, 0.00151824951171875, -0.08203125, -0.11865234375, -0.1259765625, 0.1220703125, 0.134765625, -0.08642578125, 0.1875, 0.283203125, 0.1142578125, -0.09130859375, -0.251953125, -0.006378173828125, 0.02880859375, 0.11474609375, -0.0927734375, -0.05859375, 0.1689453125, 0.37109375, -0.1728515625, -0.01324462890625, -0.01519775390625, -0.010009765625, 0.08203125, -0.0185546875, -0.0751953125, 0.0228271484375, 0.0791015625, 0.259765625, -0.095703125, -0.1669921875, 0.123046875, -0.00860595703125, -0.1513671875, 0.059326171875, 0.193359375, 0.047607421875, 0.1640625, -0.26171875, -0.0634765625, -0.1259765625, 0.07080078125, -0.119140625, 0.19921875, -0.00982666015625, -0.0216064453125, 0.166015625, -0.2109375, 0.224609375, 0.09814453125, 0.265625, -0.083984375, -0.01806640625, 0.1337890625, -0.0106201171875, -0.04443359375, -0.035888671875, 0.062255859375, 0.12060546875, -0.083984375, 0.134765625, 0.11376953125, -0.0908203125, 0.24609375, 0.107421875, 0.138671875, 0.0125732421875, 0.011474609375, 0.0157470703125, -0.10986328125, 0.0308837890625, -0.087890625, -0.00921630859375, -0.19921875, 0.1787109375, -0.17578125, -0.1474609375, 0.016357421875, 0.058837890625, -0.0576171875, -0.09814453125, 0.1201171875, -0.004364013671875, 0.055419921875, 0.1494140625, 0.3515625, 0.10888671875, 0.203125, 0.11083984375, 0.014892578125, 0.095703125, 0.031005859375, 0.119140625, 0.0966796875, -0.306640625, -0.018310546875, 0.08984375, 0.09765625, -0.0517578125, -0.030029296875, -0.0244140625, 0.00390625, 0.00191497802734375, 0.189453125, -0.1728515625, -0.1533203125, 0.1669921875, 0.038330078125, -0.2236328125, 0.06005859375, -0.1953125, -0.1435546875, 0.29296875, -0.080078125, 0.0830078125, 0.05908203125, 0.0225830078125, -0.028076171875, 0.1591796875, 0.0238037109375, 0.080078125, -0.058837890625, -0.037841796875, 0.154296875, 0.19921875, -0.0196533203125, 0.0556640625]}, {"lineage": "H3", "source": "MiniMaxAI/MiniMax-H3/transformer_ref", "key": "transformer_blocks.10.attn.to_out.0.weight", "dtype": "BF16", "values": [0.01171875, 0.0732421875, -0.1259765625, -0.0196533203125, -0.044189453125, 0.08642578125, -0.0098876953125, 0.2578125, 0.2197265625, 0.20703125, -0.07275390625, -0.08251953125, -0.169921875, -0.10595703125, -0.02392578125, -0.03564453125, 0.2275390625, -0.05224609375, 0.06103515625, -0.10009765625, 0.03515625, -0.2275390625, 0.05908203125, -0.1640625, -0.1806640625, 0.052734375, 0.0966796875, 0.2021484375, -0.0068359375, -0.0908203125, -0.16796875, 0.026611328125, 0.169921875, -0.031494140625, 0.1220703125, 0.11083984375, -0.05078125, 0.177734375, 0.0013580322265625, -0.078125, -0.0279541015625, 0.04638671875, -0.0556640625, -0.04541015625, 0.035400390625, 0.1865234375, 0.11767578125, 0.11962890625, -0.1630859375, -0.0322265625, -0.0859375, -0.00787353515625, -0.0286865234375, -0.09228515625, -0.1806640625, 0.12158203125, 0.1767578125, 0.236328125, 0.008544921875, -0.0712890625, -0.1181640625, 0.1640625, 0.052734375, -0.1630859375, -0.1318359375, 0.052978515625, 0.0751953125, -0.11083984375, 0.00860595703125, -0.220703125, 0.1845703125, -0.07275390625, -0.125, -0.29296875, -0.00457763671875, -0.08056640625, -0.0220947265625, 0.1484375, -0.2109375, -0.09814453125, -0.09912109375, -0.09130859375, 0.1748046875, -0.01904296875, 0.0220947265625, 0.087890625, -0.04345703125, 0.005157470703125, -0.0107421875, 0.09375, 0.0888671875, 0.010986328125, -0.267578125, 0.0458984375, -0.0703125, 0.083984375, -0.050537109375, 0.031005859375, 0.072265625, -0.037109375, -0.1103515625, -0.234375, -0.0908203125, -0.15234375, -0.1484375, -0.0458984375, -0.00421142578125, -0.03271484375, 0.0203857421875, 0.1171875, 0.05078125, -0.134765625, 0.0048828125, 0.2158203125, 0.05078125, 0.12158203125, -0.1513671875, -0.026123046875, 0.04296875, -0.1826171875, 0.00860595703125, 0.10302734375, 0.0888671875, 0.197265625, -0.09326171875, 0.037109375, 0.031982421875, 0.12890625, -0.09326171875, -0.0031890869140625, -0.07861328125, -0.1201171875, -0.1298828125, 0.126953125, 0.1376953125, -0.08056640625, 0.1845703125, 0.275390625, 0.10986328125, -0.09130859375, -0.255859375, -0.00787353515625, 0.0244140625, 0.12060546875, -0.08984375, -0.055419921875, 0.166015625, 0.376953125, -0.16796875, -0.01239013671875, -0.0201416015625, -0.006561279296875, 0.0830078125, -0.01153564453125, -0.0751953125, 0.0242919921875, 0.0888671875, 0.2578125, -0.09912109375, -0.1650390625, 0.12060546875, -0.005767822265625, -0.1484375, 0.05810546875, 0.1904296875, 0.04833984375, 0.166015625, -0.259765625, -0.0654296875, -0.12890625, 0.07177734375, -0.11376953125, 0.19921875, -0.01361083984375, -0.017333984375, 0.1640625, -0.2109375, 0.2197265625, 0.09130859375, 0.267578125, -0.08837890625, -0.0269775390625, 0.1357421875, -0.01336669921875, -0.0400390625, -0.037353515625, 0.061767578125, 0.125, -0.08154296875, 0.134765625, 0.10693359375, -0.08837890625, 0.251953125, 0.1083984375, 0.130859375, 0.01226806640625, 0.0089111328125, 0.0181884765625, -0.11279296875, 0.0341796875, -0.08935546875, -0.01226806640625, -0.1982421875, 0.1806640625, -0.1875, -0.1337890625, 0.0179443359375, 0.061279296875, -0.052001953125, -0.10205078125, 0.11767578125, -0.006866455078125, 0.06298828125, 0.154296875, 0.35546875, 0.11376953125, 0.20703125, 0.11181640625, 0.0205078125, 0.09326171875, 0.0289306640625, 0.11767578125, 0.0927734375, -0.306640625, -0.01904296875, 0.08984375, 0.09765625, -0.053466796875, -0.0238037109375, -0.0205078125, 0.006011962890625, 0.003570556640625, 0.1884765625, -0.1689453125, -0.1552734375, 0.166015625, 0.03857421875, -0.220703125, 0.0634765625, -0.1982421875, -0.1416015625, 0.2890625, -0.08935546875, 0.076171875, 0.061767578125, 0.03271484375, -0.017822265625, 0.154296875, 0.016845703125, 0.07861328125, -0.056396484375, -0.043701171875, 0.154296875, 0.193359375, -0.015625, 0.048828125]}, {"lineage": "H3-Image", "source": "MiniMaxAI/MiniMax-H3-Image/transformer", "key": "blocks.10.attn.out_proj.weight", "dtype": "BF16", "values": [0.030029296875, 0.0245361328125, -0.1572265625, 0.0308837890625, -0.09814453125, 0.162109375, -0.06640625, 0.212890625, 0.236328125, 0.248046875, -0.08642578125, -0.095703125, -0.1865234375, -0.042236328125, -0.08056640625, -0.0791015625, 0.2080078125, -0.123046875, 0.0260009765625, -0.15234375, 0.031005859375, -0.1689453125, 0.0830078125, -0.166015625, -0.193359375, 0.029296875, 0.1083984375, 0.30859375, -0.054443359375, -0.017578125, -0.1943359375, -0.07373046875, 0.1953125, -0.0098876953125, 0.1279296875, 0.10009765625, 0.042236328125, 0.259765625, 0.08251953125, -0.1142578125, 0.02197265625, -0.051025390625, -0.07470703125, -0.04931640625, -0.078125, 0.2041015625, 0.06298828125, 0.2373046875, -0.1435546875, -0.0732421875, -0.10205078125, 0.0361328125, -0.0084228515625, -0.10009765625, -0.1806640625, 0.1572265625, 0.1435546875, 0.2578125, 0.048828125, -0.1396484375, -0.232421875, 0.1591796875, 0.0966796875, -0.134765625, -0.051513671875, 0.1220703125, 0.09521484375, -0.1875, -0.05908203125, -0.234375, 0.2333984375, -0.11181640625, -0.1513671875, -0.296875, 0.0810546875, -0.06396484375, 0.02587890625, 0.169921875, -0.2470703125, -0.09619140625, -0.09375, -0.056640625, 0.201171875, -0.0167236328125, -0.0001544952392578125, 0.125, -0.05419921875, 0.04638671875, 0.041015625, 0.1533203125, 0.10498046875, 0.061767578125, -0.287109375, 0.1396484375, -0.11083984375, 0.0283203125, -0.08056640625, 0.072265625, 0.08935546875, -0.0654296875, -0.10205078125, -0.2275390625, -0.044189453125, -0.177734375, -0.333984375, -0.0576171875, 0.02587890625, -0.02099609375, 0.00701904296875, 0.11083984375, -0.001220703125, -0.130859375, 0.0247802734375, 0.1806640625, 0.08740234375, 0.125, -0.1826171875, -0.0296630859375, -0.06298828125, -0.1962890625, 0.08740234375, 0.08935546875, 0.109375, 0.185546875, -0.057861328125, 0.0673828125, -0.064453125, 0.166015625, -0.0986328125, 0.032958984375, 0.0439453125, -0.169921875, -0.107421875, 0.080078125, 0.083984375, -0.00665283203125, 0.2490234375, 0.330078125, 0.11181640625, -0.11669921875, -0.357421875, 0.0250244140625, -0.0234375, 0.1328125, -0.10009765625, -0.07275390625, 0.1279296875, 0.37109375, -0.138671875, -0.078125, 0.05517578125, 0.007080078125, 0.09326171875, -0.08251953125, -0.0264892578125, 0.0771484375, 0.103515625, 0.294921875, -0.11572265625, -0.1845703125, 0.123046875, -0.045654296875, -0.12158203125, 0.052490234375, 0.23046875, -0.044921875, 0.2333984375, -0.294921875, -0.002471923828125, -0.251953125, 0.08154296875, -0.10595703125, 0.1650390625, -0.02587890625, 0.0034332275390625, 0.1484375, -0.1875, 0.11376953125, 0.05029296875, 0.240234375, -0.115234375, 0.0277099609375, 0.0169677734375, 0.0084228515625, -0.038330078125, -0.047119140625, 0.10986328125, 0.01263427734375, -0.01251220703125, 0.060546875, 0.057861328125, -0.06982421875, 0.25, 0.1875, 0.1455078125, -0.058837890625, -0.0159912109375, 0.061767578125, -0.11083984375, 0.007568359375, 0.0184326171875, 0.08056640625, -0.169921875, 0.07373046875, -0.146484375, -0.06787109375, 0.07080078125, 0.1025390625, 0.05712890625, -0.1494140625, 0.1533203125, 0.0028228759765625, 0.10546875, 0.0250244140625, 0.2890625, 0.078125, 0.11279296875, 0.050537109375, 0.08203125, 0.07763671875, -0.002532958984375, 0.07373046875, 0.07666015625, -0.2578125, -0.1474609375, 0.068359375, 0.1650390625, -0.03759765625, -0.00836181640625, -0.038330078125, 0.033935546875, 0.0137939453125, 0.216796875, -0.15234375, -0.0869140625, 0.2119140625, -0.0181884765625, -0.1796875, 0.04296875, -0.18359375, -0.1875, 0.216796875, -0.173828125, -0.07080078125, 0.041015625, 0.09521484375, -0.07470703125, 0.193359375, 0.1005859375, -0.0142822265625, 0.023681640625, 0.044677734375, 0.2060546875, 0.1875, 0.00074005126953125, 0.03564453125]}, {"lineage": "H3-Image", "source": "MiniMaxAI/MiniMax-H3-Image/transformer_diffusers", "key": "transformer_blocks.10.attn.to_out.0.weight", "dtype": "BF16", "values": [0.030029296875, 0.0245361328125, -0.1572265625, 0.0308837890625, -0.09814453125, 0.162109375, -0.06640625, 0.212890625, 0.236328125, 0.248046875, -0.08642578125, -0.095703125, -0.1865234375, -0.042236328125, -0.08056640625, -0.0791015625, 0.2080078125, -0.123046875, 0.0260009765625, -0.15234375, 0.031005859375, -0.1689453125, 0.0830078125, -0.166015625, -0.193359375, 0.029296875, 0.1083984375, 0.30859375, -0.054443359375, -0.017578125, -0.1943359375, -0.07373046875, 0.1953125, -0.0098876953125, 0.1279296875, 0.10009765625, 0.042236328125, 0.259765625, 0.08251953125, -0.1142578125, 0.02197265625, -0.051025390625, -0.07470703125, -0.04931640625, -0.078125, 0.2041015625, 0.06298828125, 0.2373046875, -0.1435546875, -0.0732421875, -0.10205078125, 0.0361328125, -0.0084228515625, -0.10009765625, -0.1806640625, 0.1572265625, 0.1435546875, 0.2578125, 0.048828125, -0.1396484375, -0.232421875, 0.1591796875, 0.0966796875, -0.134765625, -0.051513671875, 0.1220703125, 0.09521484375, -0.1875, -0.05908203125, -0.234375, 0.2333984375, -0.11181640625, -0.1513671875, -0.296875, 0.0810546875, -0.06396484375, 0.02587890625, 0.169921875, -0.2470703125, -0.09619140625, -0.09375, -0.056640625, 0.201171875, -0.0167236328125, -0.0001544952392578125, 0.125, -0.05419921875, 0.04638671875, 0.041015625, 0.1533203125, 0.10498046875, 0.061767578125, -0.287109375, 0.1396484375, -0.11083984375, 0.0283203125, -0.08056640625, 0.072265625, 0.08935546875, -0.0654296875, -0.10205078125, -0.2275390625, -0.044189453125, -0.177734375, -0.333984375, -0.0576171875, 0.02587890625, -0.02099609375, 0.00701904296875, 0.11083984375, -0.001220703125, -0.130859375, 0.0247802734375, 0.1806640625, 0.08740234375, 0.125, -0.1826171875, -0.0296630859375, -0.06298828125, -0.1962890625, 0.08740234375, 0.08935546875, 0.109375, 0.185546875, -0.057861328125, 0.0673828125, -0.064453125, 0.166015625, -0.0986328125, 0.032958984375, 0.0439453125, -0.169921875, -0.107421875, 0.080078125, 0.083984375, -0.00665283203125, 0.2490234375, 0.330078125, 0.11181640625, -0.11669921875, -0.357421875, 0.0250244140625, -0.0234375, 0.1328125, -0.10009765625, -0.07275390625, 0.1279296875, 0.37109375, -0.138671875, -0.078125, 0.05517578125, 0.007080078125, 0.09326171875, -0.08251953125, -0.0264892578125, 0.0771484375, 0.103515625, 0.294921875, -0.11572265625, -0.1845703125, 0.123046875, -0.045654296875, -0.12158203125, 0.052490234375, 0.23046875, -0.044921875, 0.2333984375, -0.294921875, -0.002471923828125, -0.251953125, 0.08154296875, -0.10595703125, 0.1650390625, -0.02587890625, 0.0034332275390625, 0.1484375, -0.1875, 0.11376953125, 0.05029296875, 0.240234375, -0.115234375, 0.0277099609375, 0.0169677734375, 0.0084228515625, -0.038330078125, -0.047119140625, 0.10986328125, 0.01263427734375, -0.01251220703125, 0.060546875, 0.057861328125, -0.06982421875, 0.25, 0.1875, 0.1455078125, -0.058837890625, -0.0159912109375, 0.061767578125, -0.11083984375, 0.007568359375, 0.0184326171875, 0.08056640625, -0.169921875, 0.07373046875, -0.146484375, -0.06787109375, 0.07080078125, 0.1025390625, 0.05712890625, -0.1494140625, 0.1533203125, 0.0028228759765625, 0.10546875, 0.0250244140625, 0.2890625, 0.078125, 0.11279296875, 0.050537109375, 0.08203125, 0.07763671875, -0.002532958984375, 0.07373046875, 0.07666015625, -0.2578125, -0.1474609375, 0.068359375, 0.1650390625, -0.03759765625, -0.00836181640625, -0.038330078125, 0.033935546875, 0.0137939453125, 0.216796875, -0.15234375, -0.0869140625, 0.2119140625, -0.0181884765625, -0.1796875, 0.04296875, -0.18359375, -0.1875, 0.216796875, -0.173828125, -0.07080078125, 0.041015625, 0.09521484375, -0.07470703125, 0.193359375, 0.1005859375, -0.0142822265625, 0.023681640625, 0.044677734375, 0.2060546875, 0.1875, 0.00074005126953125, 0.03564453125]}]}
|
code/hfeco/family.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""What a model family has to define. Everything else in hfeco is family-agnostic.
|
| 2 |
+
|
| 3 |
+
To add a family (say MiniMax-M3): write hfeco/families/m3.py that builds a Family,
|
| 4 |
+
register it in hfeco/families/__init__.py, run scripts/build_reference.py --family m3,
|
| 5 |
+
then scripts/daily.py --family m3. Storage, the daily job and the dashboard pick it up
|
| 6 |
+
by its key.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import re
|
| 10 |
+
from dataclasses import dataclass, field
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
from typing import Callable, Optional
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass
|
| 16 |
+
class Member:
|
| 17 |
+
lineage: str # short label used everywhere, e.g. "H3-Image"
|
| 18 |
+
base: str # official repo id
|
| 19 |
+
modality: str # video | image | text | audio | ...
|
| 20 |
+
text_hint: Optional[re.Pattern] = None # how cards/names refer to this member specifically
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@dataclass
|
| 24 |
+
class Family:
|
| 25 |
+
key: str # storage / URL key, e.g. "h3"
|
| 26 |
+
title: str # shown on the dashboard
|
| 27 |
+
members: list
|
| 28 |
+
default_member: str # a generic mention of the family means this member
|
| 29 |
+
|
| 30 |
+
# discovery
|
| 31 |
+
name_queries: list # Hub name search (substring of repo id)
|
| 32 |
+
fulltext_queries: list # Hub README full-text search
|
| 33 |
+
tag_filters: list = field(default_factory=list)
|
| 34 |
+
family_text: re.Pattern = None # any mention of the family in names/cards
|
| 35 |
+
name_hint: re.Pattern = None # names worth probing even without other signals
|
| 36 |
+
|
| 37 |
+
# structural evidence (tier 1)
|
| 38 |
+
sig_dims: set = field(default_factory=set) # hidden sizes that identify the family's
|
| 39 |
+
sig_names: re.Pattern = None # block tensors (with sig_names)
|
| 40 |
+
marker_rules: list = field(default_factory=list) # (regex on tensor names, lineage, reason, full_weights_only)
|
| 41 |
+
meta_rules: list = field(default_factory=list) # (regex on safetensors __metadata__, lineage, reason)
|
| 42 |
+
index_rules: list = field(default_factory=list) # (substring of model_index.json, lineage)
|
| 43 |
+
config_rules: list = field(default_factory=list) # (regex on config model_type/architectures, lineage)
|
| 44 |
+
extra_structural: Optional[Callable] = None # fn(ev, ctx) -> [(lineage, reason)]
|
| 45 |
+
probe_names: list = field(default_factory=list) # tensor names for the value probe
|
| 46 |
+
probe_prefixes: tuple = ("model.diffusion_model.", "diffusion_model.", "transformer.", "model.", "")
|
| 47 |
+
probe_sources: list = field(default_factory=list) # (lineage, repo, folder) to build the reference
|
| 48 |
+
|
| 49 |
+
# tier 2: card text rules (regex on README, lineage, weight, reason, skip_for_text_llm)
|
| 50 |
+
card_rules: list = field(default_factory=list)
|
| 51 |
+
|
| 52 |
+
# text models around the family
|
| 53 |
+
text_member: Optional[str] = None # lineage of an official text-model member (e.g. PE)
|
| 54 |
+
text_member_hint: Optional[re.Pattern] = None
|
| 55 |
+
text_component: Optional[re.Pattern] = None # e.g. the family's own text encoder
|
| 56 |
+
component_names: Optional[re.Pattern] = None
|
| 57 |
+
native_quant: dict = field(default_factory=dict) # lineage -> regex of the member's own quant format
|
| 58 |
+
|
| 59 |
+
_ref: dict = None
|
| 60 |
+
|
| 61 |
+
@property
|
| 62 |
+
def lineages(self):
|
| 63 |
+
return [m.lineage for m in self.members]
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
def bases(self):
|
| 67 |
+
return [m.base for m in self.members]
|
| 68 |
+
|
| 69 |
+
def member(self, lineage):
|
| 70 |
+
return next(m for m in self.members if m.lineage == lineage)
|
| 71 |
+
|
| 72 |
+
def base_of(self, lineage):
|
| 73 |
+
return self.member(lineage).base
|
| 74 |
+
|
| 75 |
+
def lineage_of_base(self):
|
| 76 |
+
return {m.base: m.lineage for m in self.members}
|
| 77 |
+
|
| 78 |
+
def reference_path(self):
|
| 79 |
+
return Path(__file__).parent / "families" / f"{self.key}_reference.json"
|
| 80 |
+
|
| 81 |
+
@property
|
| 82 |
+
def ref(self):
|
| 83 |
+
if self._ref is None:
|
| 84 |
+
p = self.reference_path()
|
| 85 |
+
self._ref = json.loads(p.read_text()) if p.exists() else {"sha256": {}, "probes": []}
|
| 86 |
+
return self._ref
|
code/hfeco/hub.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Thin, retrying wrappers around the Hugging Face Hub API."""
|
| 2 |
+
import random
|
| 3 |
+
import time
|
| 4 |
+
|
| 5 |
+
import httpx
|
| 6 |
+
import requests
|
| 7 |
+
from huggingface_hub import HfApi, get_token
|
| 8 |
+
from huggingface_hub.utils import HfHubHTTPError
|
| 9 |
+
|
| 10 |
+
api = HfApi()
|
| 11 |
+
|
| 12 |
+
MODEL_EXPAND = ["downloads", "downloadsAllTime", "likes", "createdAt", "lastModified",
|
| 13 |
+
"pipeline_tag", "library_name", "tags", "cardData", "gated", "sha"]
|
| 14 |
+
DATASET_EXPAND = ["downloads", "downloadsAllTime", "likes", "createdAt", "lastModified",
|
| 15 |
+
"tags", "cardData", "gated", "sha"]
|
| 16 |
+
SPACE_EXPAND = ["likes", "createdAt", "lastModified", "sdk", "tags", "cardData", "models",
|
| 17 |
+
"datasets", "sha", "runtime"]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def retry(fn, *a, tries=6, **kw):
|
| 21 |
+
for i in range(tries):
|
| 22 |
+
try:
|
| 23 |
+
return fn(*a, **kw)
|
| 24 |
+
except (HfHubHTTPError, requests.RequestException, httpx.HTTPError) as e:
|
| 25 |
+
code = getattr(getattr(e, "response", None), "status_code", None)
|
| 26 |
+
if code in (401, 403, 404, 410):
|
| 27 |
+
raise
|
| 28 |
+
if i == tries - 1:
|
| 29 |
+
raise
|
| 30 |
+
time.sleep((2 ** i) * (6 if code == 429 else 1) + random.random())
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def listing(kind, **kw):
|
| 34 |
+
"""Fully materialised listing (models/datasets/spaces) with retries."""
|
| 35 |
+
fn = {"model": api.list_models, "dataset": api.list_datasets, "space": api.list_spaces}[kind]
|
| 36 |
+
expand = {"model": MODEL_EXPAND, "dataset": DATASET_EXPAND, "space": SPACE_EXPAND}[kind]
|
| 37 |
+
return retry(lambda: list(fn(expand=expand, **kw)))
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def info(kind, repo_id, **kw):
|
| 41 |
+
fn = {"model": api.model_info, "dataset": api.dataset_info, "space": api.space_info}[kind]
|
| 42 |
+
if "expand" not in kw and "files_metadata" not in kw:
|
| 43 |
+
kw["expand"] = {"model": MODEL_EXPAND, "dataset": DATASET_EXPAND, "space": SPACE_EXPAND}[kind]
|
| 44 |
+
return retry(fn, repo_id, **kw)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def full_text(q, kind, page=100, cap=5000):
|
| 48 |
+
"""All hits of the Hub's README full-text search; returns repo ids."""
|
| 49 |
+
out, skip = [], 0
|
| 50 |
+
h = {"Authorization": f"Bearer {get_token()}"} if get_token() else {}
|
| 51 |
+
while skip < cap:
|
| 52 |
+
r = retry(requests.get, "https://huggingface.co/api/search/full-text",
|
| 53 |
+
params={"q": q, "type": kind, "limit": page, "skip": skip}, headers=h, timeout=60)
|
| 54 |
+
r.raise_for_status()
|
| 55 |
+
hits = r.json().get("hits", [])
|
| 56 |
+
if not hits:
|
| 57 |
+
break
|
| 58 |
+
out += [x["name"] for x in hits if x.get("type") == kind and not x.get("isPrivate")]
|
| 59 |
+
skip += page
|
| 60 |
+
return sorted(set(out))
|
code/hfeco/metrics.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Turn raw snapshots + labels into the dashboard's data.json."""
|
| 2 |
+
import datetime as dt
|
| 3 |
+
import json
|
| 4 |
+
|
| 5 |
+
import pandas as pd
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
REL_ORDER = ["adapter", "finetune", "quantized", "repackage", "merge", "mirror", "component"]
|
| 9 |
+
HF_ORDER = ["adapter", "finetune", "merge", "quantized"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def daily_downloads(raw):
|
| 13 |
+
"""Per repo and day: downloads since the previous snapshot, per 24h.
|
| 14 |
+
|
| 15 |
+
The first time a repo is seen it has no previous value, so it contributes nothing
|
| 16 |
+
that day (its all-time total is not counted as one day's downloads).
|
| 17 |
+
"""
|
| 18 |
+
df = raw[raw.kind != "space"][["repo_id", "kind", "day", "fetched_at", "downloads_all_time"]].copy()
|
| 19 |
+
df["t"] = pd.to_datetime(df.fetched_at)
|
| 20 |
+
df = df.sort_values(["kind", "repo_id", "t"])
|
| 21 |
+
g = df.groupby(["kind", "repo_id"])
|
| 22 |
+
df["prev"] = g.downloads_all_time.shift()
|
| 23 |
+
df["prev_t"] = g.t.shift()
|
| 24 |
+
hours = (df.t - df.prev_t).dt.total_seconds() / 3600
|
| 25 |
+
delta = df.downloads_all_time - df.prev
|
| 26 |
+
df["negative"] = delta < 0
|
| 27 |
+
df["daily"] = (delta.clip(lower=0) * 24 / hours).where(df.prev.notna())
|
| 28 |
+
return df[["kind", "repo_id", "day", "daily", "negative"]]
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def build(raw, labels, hf_tree_counts, fam):
|
| 32 |
+
days = sorted(raw.day.unique())
|
| 33 |
+
today = days[-1]
|
| 34 |
+
lab = pd.DataFrame(labels)
|
| 35 |
+
cur = raw[raw.day == today].merge(lab, on=["kind", "repo_id"], how="left")
|
| 36 |
+
dd = daily_downloads(raw)
|
| 37 |
+
famdf = cur[cur.family.fillna(False).astype(bool)]
|
| 38 |
+
|
| 39 |
+
out = {"generated_at": dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds"),
|
| 40 |
+
"snapshot_days": days, "today": today,
|
| 41 |
+
"classifier_version": lab.classifier_version.iloc[0] if len(lab) else None,
|
| 42 |
+
"family": {"key": fam.key, "title": fam.title,
|
| 43 |
+
"members": [{"lineage": m.lineage, "base": m.base, "modality": m.modality}
|
| 44 |
+
for m in fam.members]},
|
| 45 |
+
"rel_order": REL_ORDER, "lineages": {}}
|
| 46 |
+
lob = fam.lineage_of_base()
|
| 47 |
+
for lin in fam.lineages:
|
| 48 |
+
base = fam.base_of(lin)
|
| 49 |
+
sub = famdf[(famdf.lineage == lin)]
|
| 50 |
+
models = sub[(sub.kind == "model") & sub.relation.isin(REL_ORDER)]
|
| 51 |
+
spaces = sub[sub.kind == "space"]
|
| 52 |
+
datasets = sub[sub.kind == "dataset"]
|
| 53 |
+
tools = sub[(sub.kind == "model") & sub.relation.isin(["tool", "no-weights"])]
|
| 54 |
+
off = cur[cur.repo_id == base]
|
| 55 |
+
# daily series by relation
|
| 56 |
+
d = dd.merge(models[["repo_id", "relation"]], on="repo_id")
|
| 57 |
+
daily = (d.dropna(subset=["daily"]).groupby(["day", "relation"]).daily.sum()
|
| 58 |
+
.round().astype(int).reset_index())
|
| 59 |
+
off_daily = dd[(dd.repo_id == base)].dropna(subset=["daily"])
|
| 60 |
+
# growth by creation date (real history)
|
| 61 |
+
cr = models.assign(month=models.created_at.str[:10]).groupby(["month", "relation"]).size()
|
| 62 |
+
growth = [{"date": k[0], "relation": k[1], "n": int(v)} for k, v in cr.items()]
|
| 63 |
+
by_rel = {}
|
| 64 |
+
is_copy = models["flags"].apply(lambda f: "copy" in (f if isinstance(f, list) else []))
|
| 65 |
+
for rel in REL_ORDER:
|
| 66 |
+
m = models[models.relation == rel]
|
| 67 |
+
by_rel[rel] = {"n": int(len(m)), "dl30": int(m.downloads_30d.fillna(0).sum()),
|
| 68 |
+
"dlall": int(m.downloads_all_time.fillna(0).sum()),
|
| 69 |
+
"copies": int(is_copy[models.relation == rel].sum())}
|
| 70 |
+
decl = models.declared_status.value_counts().to_dict()
|
| 71 |
+
out["lineages"][lin] = {
|
| 72 |
+
"base": base,
|
| 73 |
+
"official": {"dl30": _i(off.downloads_30d), "dlall": _i(off.downloads_all_time),
|
| 74 |
+
"likes": _i(off.likes),
|
| 75 |
+
"daily": [{"day": r.day, "n": int(round(r.daily))} for r in off_daily.itertuples()]},
|
| 76 |
+
"n_models": int(len(models)),
|
| 77 |
+
"n_copies": int(is_copy.sum()),
|
| 78 |
+
"dl30": int(models.downloads_30d.fillna(0).sum()),
|
| 79 |
+
"dlall": int(models.downloads_all_time.fillna(0).sum()),
|
| 80 |
+
"n_spaces": int(len(spaces)), "space_likes": int(spaces.likes.fillna(0).sum()),
|
| 81 |
+
"n_datasets": int(len(datasets)), "n_tools": int(len(tools)),
|
| 82 |
+
"by_relation": by_rel,
|
| 83 |
+
"hf_tree": hf_tree_counts.get(base, {}),
|
| 84 |
+
"declared": {k: int(v) for k, v in decl.items()},
|
| 85 |
+
"confidence": {k: int(v) for k, v in models.confidence.value_counts().items()},
|
| 86 |
+
"daily": daily.to_dict("records"),
|
| 87 |
+
"growth": growth,
|
| 88 |
+
}
|
| 89 |
+
out["unknown_family"] = int(((famdf.lineage == "unknown") & (famdf.kind == "model")).sum())
|
| 90 |
+
|
| 91 |
+
# Repo table: every family repo plus repos HF counts under a family base but we reject.
|
| 92 |
+
rows = []
|
| 93 |
+
last = dd[dd.day == today].set_index("repo_id").daily.to_dict()
|
| 94 |
+
hf_base_children = {}
|
| 95 |
+
for r in cur.itertuples():
|
| 96 |
+
for p in r.hf_parents:
|
| 97 |
+
if p.split(":", 1)[1] in lob:
|
| 98 |
+
hf_base_children[r.repo_id] = lob[p.split(":", 1)[1]]
|
| 99 |
+
keep = cur[cur.family.fillna(False).astype(bool) | cur.repo_id.isin(hf_base_children)]
|
| 100 |
+
for r in keep.itertuples():
|
| 101 |
+
rows.append({
|
| 102 |
+
"id": r.repo_id, "kind": r.kind, "lineage": r.lineage, "relation": r.relation,
|
| 103 |
+
"conf": r.confidence, "dl30": _i(r.downloads_30d), "dlall": _i(r.downloads_all_time),
|
| 104 |
+
"d1": None if pd.isna(last.get(r.repo_id)) else int(round(last.get(r.repo_id))),
|
| 105 |
+
"likes": _i(r.likes), "created": (r.created_at or "")[:10],
|
| 106 |
+
"declared": r.declared_status if isinstance(r.declared_status, str) else None,
|
| 107 |
+
"hf_under": hf_base_children.get(r.repo_id),
|
| 108 |
+
"proposed": r.proposed_base_model if isinstance(r.proposed_base_model, str) else None,
|
| 109 |
+
"copy_of": r.copy_of if isinstance(r.copy_of, str) else None,
|
| 110 |
+
"flags": list(r.flags) if isinstance(r.flags, list) else [],
|
| 111 |
+
"evidence": list(r.evidence) if isinstance(r.evidence, list) else [],
|
| 112 |
+
})
|
| 113 |
+
out["repos"] = rows
|
| 114 |
+
return out
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def hf_tree_counts(raw_today, fam):
|
| 118 |
+
"""What the Hub's Model tree shows: direct children per relation tag."""
|
| 119 |
+
out = {b: {k: 0 for k in HF_ORDER} for b in fam.bases}
|
| 120 |
+
for r in raw_today[raw_today.kind == "model"].itertuples():
|
| 121 |
+
for p in r.hf_parents:
|
| 122 |
+
rel, parent = p.split(":", 1)
|
| 123 |
+
if parent in out and rel in out[parent]:
|
| 124 |
+
out[parent][rel] += 1
|
| 125 |
+
return out
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def _i(x):
|
| 129 |
+
try:
|
| 130 |
+
v = x.iloc[0] if hasattr(x, "iloc") else x
|
| 131 |
+
return None if pd.isna(v) else int(v)
|
| 132 |
+
except (IndexError, ValueError, TypeError):
|
| 133 |
+
return None
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def dump(obj, path):
|
| 137 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 138 |
+
path.write_text(json.dumps(obj, ensure_ascii=False, separators=(",", ":"), default=str))
|
code/hfeco/pipeline.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Select candidates worth probing, probe them (cached by repo sha)."""
|
| 2 |
+
import json
|
| 3 |
+
import re
|
| 4 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 5 |
+
|
| 6 |
+
from . import enrich, store
|
| 7 |
+
|
| 8 |
+
NLP_TAGS = {"text-classification", "token-classification", "fill-mask", "question-answering",
|
| 9 |
+
"sentence-similarity", "feature-extraction", "text-ranking", "robotics",
|
| 10 |
+
"reinforcement-learning", "automatic-speech-recognition", "translation", "summarization"}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def worth_probing(r, fam):
|
| 14 |
+
"""Cheap pre-filter: skip name-search hits whose only link to the family is a substring
|
| 15 |
+
of another word (MiniLM-L12-H384, H3K27ac ...)."""
|
| 16 |
+
if r["kind"] != "model":
|
| 17 |
+
return False
|
| 18 |
+
if any(s.split(":")[0] in ("tree", "tag", "fulltext") for s in r["sources"]):
|
| 19 |
+
return True
|
| 20 |
+
if fam.name_hint and fam.name_hint.search(r["repo_id"].split("/")[1]):
|
| 21 |
+
return r["pipeline_tag"] not in NLP_TAGS
|
| 22 |
+
return bool(fam.family_text.search(r["repo_id"]))
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def cache_path(fam):
|
| 26 |
+
return store.LOCAL / "cache" / fam.key / "enrich.jsonl"
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def load_cache(fam):
|
| 30 |
+
out = {}
|
| 31 |
+
p = cache_path(fam)
|
| 32 |
+
if p.exists():
|
| 33 |
+
for line in p.open():
|
| 34 |
+
e = json.loads(line)
|
| 35 |
+
out[e["repo_id"]] = e
|
| 36 |
+
return out
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def enrich_all(raw_today, fam, workers=8, log=print):
|
| 40 |
+
cache = load_cache(fam)
|
| 41 |
+
rows = [r for r in raw_today.to_dict("records") if worth_probing(r, fam)]
|
| 42 |
+
todo = [r["repo_id"] for r in rows if cache.get(r["repo_id"], {}).get("sha") != r["sha"]]
|
| 43 |
+
log(f"probe: {len(rows)} worth probing, {len(todo)} new or changed")
|
| 44 |
+
|
| 45 |
+
def one(rid):
|
| 46 |
+
try:
|
| 47 |
+
return enrich.enrich_model(rid, fam)
|
| 48 |
+
except Exception as e:
|
| 49 |
+
return {"repo_id": rid, "sha": None, "errors": [f"fatal: {type(e).__name__}: {e}"]}
|
| 50 |
+
done = 0
|
| 51 |
+
with ThreadPoolExecutor(workers) as ex:
|
| 52 |
+
for ev in ex.map(one, todo):
|
| 53 |
+
cache[ev["repo_id"]] = ev
|
| 54 |
+
done += 1
|
| 55 |
+
if done % 100 == 0:
|
| 56 |
+
log(f"probe: {done}/{len(todo)}")
|
| 57 |
+
p = cache_path(fam)
|
| 58 |
+
p.parent.mkdir(parents=True, exist_ok=True)
|
| 59 |
+
with p.open("w") as f:
|
| 60 |
+
for e in cache.values():
|
| 61 |
+
f.write(json.dumps(e, default=str) + "\n")
|
| 62 |
+
return cache, p
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def reprobe(raw_today, fam, cache, predicate, workers=8, log=print):
|
| 66 |
+
"""Probe again the cached repos matching predicate(ev) (after an enrich.py upgrade)."""
|
| 67 |
+
todo = [rid for rid, ev in cache.items() if predicate(ev)]
|
| 68 |
+
log(f"re-probe: {len(todo)} repos")
|
| 69 |
+
|
| 70 |
+
def one(rid):
|
| 71 |
+
try:
|
| 72 |
+
return enrich.enrich_model(rid, fam)
|
| 73 |
+
except Exception as e:
|
| 74 |
+
return {"repo_id": rid, "sha": None, "errors": [f"fatal: {type(e).__name__}: {e}"]}
|
| 75 |
+
with ThreadPoolExecutor(workers) as ex:
|
| 76 |
+
for ev in ex.map(one, todo):
|
| 77 |
+
cache[ev["repo_id"]] = ev
|
| 78 |
+
p = cache_path(fam)
|
| 79 |
+
with p.open("w") as f:
|
| 80 |
+
for e in cache.values():
|
| 81 |
+
f.write(json.dumps(e, default=str) + "\n")
|
| 82 |
+
return cache
|
code/hfeco/store.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Storage layout (same in the local mirror and in the private HF dataset repo).
|
| 2 |
+
|
| 3 |
+
raw/<family>/YYYY-MM-DD.parquet one row per candidate repo per day; append-only, never
|
| 4 |
+
edited. Daily downloads are derived at read time by
|
| 5 |
+
differencing downloads_all_time between snapshots.
|
| 6 |
+
labels/<family>/latest.parquet current classification (lineage, relation, evidence),
|
| 7 |
+
versioned by classifier_version; recomputed freely.
|
| 8 |
+
cache/<family>/enrich.jsonl per-repo file/header evidence keyed by repo sha, so
|
| 9 |
+
unchanged repos are not probed again.
|
| 10 |
+
"""
|
| 11 |
+
import datetime as dt
|
| 12 |
+
import json
|
| 13 |
+
import os
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
import pandas as pd
|
| 17 |
+
|
| 18 |
+
from .hub import api
|
| 19 |
+
|
| 20 |
+
DATASET_REPO = os.environ.get("HFECO_DATASET", "MiniMaxAI/oss-ecosystem-data")
|
| 21 |
+
LOCAL = Path(os.environ.get("HFECO_LOCAL", Path(__file__).resolve().parent.parent / "data"))
|
| 22 |
+
|
| 23 |
+
LIST_COLS = ["tags", "card_base_model", "hf_parents", "space_models", "sources"]
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def write_raw(rows, fam_key, day=None):
|
| 27 |
+
day = day or dt.datetime.now(dt.timezone.utc).date().isoformat()
|
| 28 |
+
df = pd.DataFrame(rows)
|
| 29 |
+
for c in LIST_COLS:
|
| 30 |
+
df[c] = df[c].apply(lambda v: json.dumps(list(v or [])))
|
| 31 |
+
p = LOCAL / "raw" / fam_key / f"{day}.parquet"
|
| 32 |
+
p.parent.mkdir(parents=True, exist_ok=True)
|
| 33 |
+
df.to_parquet(p, index=False)
|
| 34 |
+
return p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def read_raw(fam_key, day=None):
|
| 38 |
+
files = sorted((LOCAL / "raw" / fam_key).glob("*.parquet"))
|
| 39 |
+
if day:
|
| 40 |
+
files = [f for f in files if f.stem == day]
|
| 41 |
+
df = pd.concat([pd.read_parquet(f).assign(day=f.stem) for f in files], ignore_index=True)
|
| 42 |
+
for c in LIST_COLS:
|
| 43 |
+
df[c] = df[c].apply(json.loads)
|
| 44 |
+
return df
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def pull():
|
| 48 |
+
"""Mirror the dataset repo into LOCAL (used by the job and the Space)."""
|
| 49 |
+
from huggingface_hub import snapshot_download
|
| 50 |
+
snapshot_download(DATASET_REPO, repo_type="dataset", local_dir=LOCAL)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def push(paths, message):
|
| 54 |
+
from huggingface_hub import CommitOperationAdd
|
| 55 |
+
ops = [CommitOperationAdd(path_in_repo=str(Path(p).resolve().relative_to(LOCAL.resolve())),
|
| 56 |
+
path_or_fileobj=str(p)) for p in paths]
|
| 57 |
+
api.create_commit(DATASET_REPO, ops, commit_message=message, repo_type="dataset")
|
code/octo-hf/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Octo-patch 新场景:hf-basemodel
|
| 2 |
+
|
| 3 |
+
给 Hugging Face 上没写或写错 `base_model` 的下游模型提 PR,让它们出现在官方模型的 Model tree 里。
|
| 4 |
+
|
| 5 |
+
## 和现有 Octo-patch 的对应关系
|
| 6 |
+
|
| 7 |
+
| Octo-patch 模式 | 本场景怎么做 |
|
| 8 |
+
|-|-|
|
| 9 |
+
| scan | 不自己找仓库。读生态看板每天产出的分类结果(私有数据集 `MiniMaxAI/oss-ecosystem-data` 的 `labels/<family>/latest.parquet`),`hf_basemodel.py candidates` 输出候选行 |
|
| 10 |
+
| patch | `hf_basemodel.py patch --repo <id> --submit`。只改模型卡 YAML 头,用 `metadata_update(create_pr=True)` 开 PR;不 fork、不 clone、没有 CI |
|
| 11 |
+
| follow | `hf_basemodel.py follow --repo <id>`,返回 PR 状态(open / merged / closed)和别人的新评论;有评论时交给 Claude Code 判断要不要回复、怎么回复 |
|
| 12 |
+
| digest | 沿用现有日报,按 reason 统计 |
|
| 13 |
+
|
| 14 |
+
Repo 主表每行一个仓库,去重键沿用 `repo_url + reason`:
|
| 15 |
+
|
| 16 |
+
| reason | 含义 | 改法 |
|
| 17 |
+
|-|-|-|
|
| 18 |
+
| `hf-base-model-add` | 没写 base_model | 加上官方底模 |
|
| 19 |
+
| `hf-base-model-fix` | base_model 指向了别的模型(比如 H3-Image 的衍生品写成 H3,PE 的重传写成 Qwen) | 换成正确的官方底模,保留其他社区父模型(如 LoRA) |
|
| 20 |
+
| `hf-base-model-relation` | 底模对了,但 HF 推断的关系错了(比如量化被算成微调) | 加 `base_model_relation` |
|
| 21 |
+
|
| 22 |
+
状态沿用 `candidate → pr_open → merged / closed`。HF 没有 CI,所以没有 `ci_failed`;仓库被删或设了访问限制时写 `skipped`。
|
| 23 |
+
|
| 24 |
+
## 进候选的条件
|
| 25 |
+
|
| 26 |
+
只提有把握、有影响、不尴尬的:
|
| 27 |
+
|
| 28 |
+
- 分类置信度为"高"(有结构证据:权重文件哈希、独有的层、权重数值、训练元数据)
|
| 29 |
+
- 累计下载 ≥ 100(`--min-downloads`)
|
| 30 |
+
- 不带 NSFW 标记,没有设访问限制
|
| 31 |
+
- 每天最多 20 个(`--limit`),按近 30 天下载从高到低
|
| 32 |
+
|
| 33 |
+
## PR 内容
|
| 34 |
+
|
| 35 |
+
标题 `Add base_model metadata` 或 `Fix base_model metadata`。正文三句:改了什么、为什么认为它基于这个底模(取分类依据里最硬的两条)、只改了 YAML 头可以随时关掉。示例:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
This PR sets `base_model: MiniMaxAI/MiniMax-H3` and `base_model_relation: quantized` in the model
|
| 39 |
+
card metadata, so this repo shows up in the model tree of MiniMaxAI/MiniMax-H3 and people can find
|
| 40 |
+
it from there.
|
| 41 |
+
|
| 42 |
+
Why we think it is based on MiniMax-H3: the weights contain the audio branch (audio_patch_proj /
|
| 43 |
+
audio_out) that only MiniMaxAI/MiniMax-H3 has.
|
| 44 |
+
|
| 45 |
+
Only the YAML header changes; the card text is untouched. Feel free to close this if it is not right.
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## 已验证
|
| 49 |
+
|
| 50 |
+
在私有沙盒仓库 `saladday1/h3eco-pr-sandbox` 上跑通了预览、提交、跟进:PR 只改 YAML 头,正文不变,main 分支不动;原来指向 Qwen 的 base_model 被正确换成 MiniMax-H3-Image-PE(Qwen 是官方 PE 自己的上游,所以视为写错)。还没有对任何别人的仓库提过 PR。
|
| 51 |
+
|
| 52 |
+
## 用法
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
python octo-hf/hf_basemodel.py candidates --family h3 # 候选行(JSON)
|
| 56 |
+
python octo-hf/hf_basemodel.py patch --family h3 --limit 5 # 预览前 5 个
|
| 57 |
+
python octo-hf/hf_basemodel.py patch --repo <id> --submit # 真正开 PR
|
| 58 |
+
python octo-hf/hf_basemodel.py follow --repo <id> # 查 PR 状态
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
需要 `huggingface_hub`、`pandas`、`pyyaml`,以及一个能在目标仓库开 PR 的 HF token(任何登录账号都能给公开仓库开 PR)。PR 作者显示为 token 对应的账号。
|
code/octo-hf/hf_basemodel.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Octo-patch scenario "hf-basemodel": add or fix base_model metadata on Hugging Face.
|
| 2 |
+
|
| 3 |
+
Three commands, mirroring Octo-patch's scan / patch / follow modes:
|
| 4 |
+
|
| 5 |
+
candidates read the classifier's labels and print the rows that would go into the
|
| 6 |
+
Repo table (one per repo, reason code hf-base-model-add / -fix / -relation)
|
| 7 |
+
patch open a PR that only edits the model card's YAML header (dry run by default;
|
| 8 |
+
--submit to actually open it)
|
| 9 |
+
follow report the state of PRs this account opened (open / merged / closed + new comments)
|
| 10 |
+
|
| 11 |
+
The PR is a pure metadata change, so no clone, build or test is needed: the script reads
|
| 12 |
+
the current card header, computes the new header, shows the diff, and on --submit calls
|
| 13 |
+
huggingface_hub.metadata_update(create_pr=True). Main is never touched.
|
| 14 |
+
"""
|
| 15 |
+
import argparse
|
| 16 |
+
import json
|
| 17 |
+
import sys
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
import pandas as pd
|
| 21 |
+
import yaml
|
| 22 |
+
from huggingface_hub import HfApi, hf_hub_download, metadata_update
|
| 23 |
+
from huggingface_hub.utils import EntryNotFoundError
|
| 24 |
+
|
| 25 |
+
ROOT = Path(__file__).resolve().parent.parent
|
| 26 |
+
sys.path.insert(0, str(ROOT))
|
| 27 |
+
from hfeco import families, store # noqa: E402
|
| 28 |
+
|
| 29 |
+
api = HfApi()
|
| 30 |
+
REASON = {"missing": "hf-base-model-add", "wrong_base": "hf-base-model-fix", "wrong_relation": "hf-base-model-relation"}
|
| 31 |
+
# Plain English for the PR body, keyed by a fragment of the classifier's evidence text.
|
| 32 |
+
WHY = [
|
| 33 |
+
("逐字节相同", "the weight files are byte-identical to the official {base} files"),
|
| 34 |
+
("音频分支", "the weights contain the audio branch (audio_patch_proj / audio_out) that only {base} has"),
|
| 35 |
+
("PDD", "the weights contain the PDD heads that only {base} has"),
|
| 36 |
+
("数值与官方", "a slice of the transformer weights is identical to the official {base} checkpoint"),
|
| 37 |
+
("数值最接近", "a slice of the transformer weights is closest to {base}, so it was trained from it"),
|
| 38 |
+
("训练信息写明", "the safetensors training metadata names {base} as the base"),
|
| 39 |
+
("model_index.json", "model_index.json uses the {base} pipeline"),
|
| 40 |
+
("文本大模型", "it is the {base} prompt-expansion model"),
|
| 41 |
+
]
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def candidates(fam, min_downloads, limit):
|
| 45 |
+
lab = pd.read_parquet(store.LOCAL / "labels" / fam.key / "latest.parquet")
|
| 46 |
+
raw = store.read_raw(fam.key)
|
| 47 |
+
raw = raw[raw.day == raw.day.max()][["repo_id", "downloads_all_time", "downloads_30d", "gated"]]
|
| 48 |
+
df = lab.merge(raw, on="repo_id")
|
| 49 |
+
df["flags"] = df.flags.apply(json.loads)
|
| 50 |
+
df["evidence"] = df.evidence.apply(json.loads)
|
| 51 |
+
keep = df[(df.kind == "model") & df.declared_status.isin(list(REASON)) & (df.confidence == "high")
|
| 52 |
+
& ~df.flags.apply(lambda f: "nsfw" in f) & (df.downloads_all_time.fillna(0) >= min_downloads)
|
| 53 |
+
& (df.gated == "False")]
|
| 54 |
+
keep = keep.sort_values("downloads_30d", ascending=False).head(limit)
|
| 55 |
+
rows = []
|
| 56 |
+
for r in keep.itertuples():
|
| 57 |
+
rows.append({"repo_url": f"https://huggingface.co/{r.repo_id}", "repo_id": r.repo_id,
|
| 58 |
+
"reason": REASON[r.declared_status], "status": "candidate",
|
| 59 |
+
"proposed_base_model": r.proposed_base_model, "proposed_relation": r.proposed_relation,
|
| 60 |
+
"lineage": r.lineage, "relation": r.relation,
|
| 61 |
+
"downloads_30d": int(r.downloads_30d or 0), "evidence": r.evidence})
|
| 62 |
+
return rows
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def current_meta(repo):
|
| 66 |
+
try:
|
| 67 |
+
text = Path(hf_hub_download(repo, "README.md", force_download=True)).read_text()
|
| 68 |
+
except EntryNotFoundError:
|
| 69 |
+
return {}, ""
|
| 70 |
+
if text.startswith("---"):
|
| 71 |
+
end = text.find("\n---", 3)
|
| 72 |
+
return (yaml.safe_load(text[3:end]) or {}), text
|
| 73 |
+
return {}, text
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def plan(repo, base, relation, fam):
|
| 77 |
+
"""New base_model / base_model_relation values, keeping unrelated parents."""
|
| 78 |
+
meta, _ = current_meta(repo)
|
| 79 |
+
old = meta.get("base_model")
|
| 80 |
+
old_list = [old] if isinstance(old, str) else list(old or [])
|
| 81 |
+
family_bases = set(fam.bases)
|
| 82 |
+
# Drop parents that point at the wrong family member or at the text model's own
|
| 83 |
+
# upstream (e.g. Qwen for a PE re-upload); keep community parents such as LoRAs.
|
| 84 |
+
keep = [b for b in old_list if b not in family_bases and not _is_upstream_of_member(b, fam)]
|
| 85 |
+
new_list = [base] + keep
|
| 86 |
+
new = {"base_model": new_list[0] if len(new_list) == 1 else new_list}
|
| 87 |
+
if relation:
|
| 88 |
+
new["base_model_relation"] = relation
|
| 89 |
+
changed = {k: v for k, v in new.items() if meta.get(k) != v}
|
| 90 |
+
return meta, changed
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def _is_upstream_of_member(b, fam):
|
| 94 |
+
for m in fam.members:
|
| 95 |
+
try:
|
| 96 |
+
card = api.model_info(m.base).card_data
|
| 97 |
+
except Exception:
|
| 98 |
+
continue
|
| 99 |
+
up = (card.to_dict() if card else {}).get("base_model")
|
| 100 |
+
if b == up or (isinstance(up, list) and b in up):
|
| 101 |
+
return True
|
| 102 |
+
return False
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def body(row):
|
| 106 |
+
base = row["proposed_base_model"]
|
| 107 |
+
why = []
|
| 108 |
+
for frag, en in WHY:
|
| 109 |
+
if any(frag in e for e in row["evidence"]):
|
| 110 |
+
why.append(en.format(base=base))
|
| 111 |
+
rel = f" and `base_model_relation: {row['proposed_relation']}`" if row["proposed_relation"] else ""
|
| 112 |
+
lines = [f"This PR sets `base_model: {base}`{rel} in the model card metadata, so this repo shows up in "
|
| 113 |
+
f"the model tree of [{base}](https://huggingface.co/{base}) and people can find it from there.", ""]
|
| 114 |
+
if why:
|
| 115 |
+
lines += ["Why we think it is based on " + base.split("/")[1] + ": " + "; ".join(why[:2]) + ".", ""]
|
| 116 |
+
lines += ["Only the YAML header changes; the card text is untouched. Feel free to close this if it is not right."]
|
| 117 |
+
return "\n".join(lines)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def patch(row, fam, submit):
|
| 121 |
+
meta, changed = plan(row["repo_id"], row["proposed_base_model"], row["proposed_relation"], fam)
|
| 122 |
+
print(f"== {row['repo_id']} ({row['reason']})")
|
| 123 |
+
print(" now:", {k: meta.get(k) for k in ("base_model", "base_model_relation")})
|
| 124 |
+
print(" new:", changed or "(nothing to change)")
|
| 125 |
+
if not changed:
|
| 126 |
+
return None
|
| 127 |
+
title = "Add base_model metadata" if row["reason"] == "hf-base-model-add" else "Fix base_model metadata"
|
| 128 |
+
if not submit:
|
| 129 |
+
print(" title:", title)
|
| 130 |
+
print(" body:\n " + body(row).replace("\n", "\n "))
|
| 131 |
+
return None
|
| 132 |
+
commit = metadata_update(row["repo_id"], changed, overwrite=True, create_pr=True,
|
| 133 |
+
commit_message=title, commit_description=body(row))
|
| 134 |
+
pr = next(d for d in api.get_repo_discussions(row["repo_id"], author=api.whoami()["name"],
|
| 135 |
+
discussion_type="pull_request") if d.title == title)
|
| 136 |
+
url = f"https://huggingface.co/{row['repo_id']}/discussions/{pr.num}"
|
| 137 |
+
print(" opened:", url, commit)
|
| 138 |
+
return url
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def follow(repo):
|
| 142 |
+
me = api.whoami()["name"]
|
| 143 |
+
for d in api.get_repo_discussions(repo, author=me, discussion_type="pull_request"):
|
| 144 |
+
det = api.get_discussion_details(repo, d.num)
|
| 145 |
+
others = [e for e in det.events if e.type == "comment" and e.author != me]
|
| 146 |
+
print(json.dumps({"repo_id": repo, "pr": d.num, "status": d.status, # open | merged | closed | draft
|
| 147 |
+
"url": f"https://huggingface.co/{repo}/discussions/{d.num}",
|
| 148 |
+
"comments_from_others": [{"author": e.author, "text": e.content[:500]} for e in others]},
|
| 149 |
+
ensure_ascii=False))
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
if __name__ == "__main__":
|
| 153 |
+
ap = argparse.ArgumentParser()
|
| 154 |
+
ap.add_argument("cmd", choices=["candidates", "patch", "follow"])
|
| 155 |
+
ap.add_argument("--family", default="h3")
|
| 156 |
+
ap.add_argument("--min-downloads", type=int, default=100)
|
| 157 |
+
ap.add_argument("--limit", type=int, default=20)
|
| 158 |
+
ap.add_argument("--repo", help="patch/follow one repo (patch takes --base/--relation for a manual row)")
|
| 159 |
+
ap.add_argument("--base")
|
| 160 |
+
ap.add_argument("--relation")
|
| 161 |
+
ap.add_argument("--submit", action="store_true", help="actually open the PR (default: dry run)")
|
| 162 |
+
a = ap.parse_args()
|
| 163 |
+
fam = families.get(a.family)
|
| 164 |
+
if a.cmd == "candidates":
|
| 165 |
+
print(json.dumps(candidates(fam, a.min_downloads, a.limit), ensure_ascii=False, indent=1))
|
| 166 |
+
elif a.cmd == "patch":
|
| 167 |
+
if a.repo and a.base: # a hand-written row, e.g. for testing on a sandbox repo
|
| 168 |
+
rows = [{"repo_id": a.repo, "reason": "hf-base-model-fix", "proposed_base_model": a.base,
|
| 169 |
+
"proposed_relation": a.relation, "evidence": []}]
|
| 170 |
+
else:
|
| 171 |
+
rows = candidates(fam, a.min_downloads, 10_000)
|
| 172 |
+
rows = [r for r in rows if not a.repo or r["repo_id"] == a.repo]
|
| 173 |
+
for r in rows[:a.limit]:
|
| 174 |
+
patch(r, fam, a.submit)
|
| 175 |
+
else:
|
| 176 |
+
follow(a.repo)
|
code/scripts/build_reference.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build hfeco/families/<family>_reference.json: official file hashes and probe values.
|
| 2 |
+
|
| 3 |
+
Run once per family (and again only if an official repo changes its weights):
|
| 4 |
+
python scripts/build_reference.py --family h3
|
| 5 |
+
"""
|
| 6 |
+
import argparse
|
| 7 |
+
import json
|
| 8 |
+
import sys
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
| 12 |
+
from hfeco import enrich, families, hub # noqa: E402
|
| 13 |
+
|
| 14 |
+
ap = argparse.ArgumentParser()
|
| 15 |
+
ap.add_argument("--family", default="h3")
|
| 16 |
+
fam = families.get(ap.parse_args().family)
|
| 17 |
+
|
| 18 |
+
ref = {"sha256": {}, "probes": []}
|
| 19 |
+
for m in fam.members:
|
| 20 |
+
for s in hub.info("model", m.base, files_metadata=True).siblings:
|
| 21 |
+
if getattr(s, "lfs", None) and s.size and s.size > 1_000_000:
|
| 22 |
+
# Members can ship identical files (H3-Image reuses H3's text encoder), so a hash
|
| 23 |
+
# maps to every member that contains it.
|
| 24 |
+
e = ref["sha256"].setdefault(s.lfs.sha256, {"lineages": [], "file": f"{m.base}/{s.rfilename}",
|
| 25 |
+
"size": s.size})
|
| 26 |
+
if m.lineage not in e["lineages"]:
|
| 27 |
+
e["lineages"].append(m.lineage)
|
| 28 |
+
|
| 29 |
+
for lin, repo, folder in fam.probe_sources:
|
| 30 |
+
files = [s.rfilename for s in hub.info("model", repo, files_metadata=True).siblings]
|
| 31 |
+
idx = [f for f in files if f.startswith(folder + "/") and f.endswith(".safetensors.index.json")
|
| 32 |
+
and f.count("/") == folder.count("/") + 1]
|
| 33 |
+
wmap = json.loads(enrich._range(repo, idx[0], 0, 20_000_000))["weight_map"]
|
| 34 |
+
for pn in fam.probe_names:
|
| 35 |
+
if pn in wmap:
|
| 36 |
+
fname = f"{folder}/{wmap[pn]}"
|
| 37 |
+
n, h = enrich.st_header(repo, fname)
|
| 38 |
+
v = enrich.st_values(repo, fname, n, h[pn])
|
| 39 |
+
ref["probes"].append({"lineage": lin, "source": f"{repo}/{folder}", "key": pn,
|
| 40 |
+
"dtype": h[pn]["dtype"], "values": [float(x) for x in v]})
|
| 41 |
+
print(lin, folder, pn, h[pn]["dtype"], [round(float(x), 5) for x in v[:4]])
|
| 42 |
+
|
| 43 |
+
fam.reference_path().write_text(json.dumps(ref))
|
| 44 |
+
print("sha256 entries:", len(ref["sha256"]), "probes:", len(ref["probes"]), "->", fam.reference_path())
|
code/scripts/daily.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Daily job: snapshot -> probe new/changed repos -> classify -> dashboard data -> push.
|
| 2 |
+
|
| 3 |
+
python scripts/daily.py [--family h3 ...] [--push] [--skip-snapshot]
|
| 4 |
+
|
| 5 |
+
Runs the same way locally and on HF Jobs. With --push it first mirrors the dataset repo,
|
| 6 |
+
stores each family's raw snapshot before anything else (the one step that cannot be
|
| 7 |
+
redone later), then pushes labels, the probe cache and the dashboard data.
|
| 8 |
+
HF_TOKEN must be able to write the dataset repo and the Space repo.
|
| 9 |
+
"""
|
| 10 |
+
import argparse
|
| 11 |
+
import json
|
| 12 |
+
import sys
|
| 13 |
+
import time
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
import pandas as pd
|
| 17 |
+
|
| 18 |
+
ROOT = Path(__file__).resolve().parent.parent
|
| 19 |
+
sys.path.insert(0, str(ROOT))
|
| 20 |
+
from hfeco import classify, discover, families, metrics, pipeline, store # noqa: E402
|
| 21 |
+
from hfeco.hub import api # noqa: E402
|
| 22 |
+
|
| 23 |
+
SPACE_REPO = "MiniMaxAI/oss-ecosystem"
|
| 24 |
+
ap = argparse.ArgumentParser()
|
| 25 |
+
ap.add_argument("--family", nargs="*", default=list(families.FAMILIES))
|
| 26 |
+
ap.add_argument("--push", action="store_true")
|
| 27 |
+
ap.add_argument("--skip-snapshot", action="store_true")
|
| 28 |
+
args = ap.parse_args()
|
| 29 |
+
t0 = time.time()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def log(m):
|
| 33 |
+
print(f"[{time.time() - t0:6.0f}s] {m}", flush=True)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
if args.push:
|
| 37 |
+
log("pull dataset")
|
| 38 |
+
store.pull()
|
| 39 |
+
|
| 40 |
+
for key in args.family:
|
| 41 |
+
fam = families.get(key)
|
| 42 |
+
log(f"== {fam.title}")
|
| 43 |
+
if not args.skip_snapshot:
|
| 44 |
+
raw_path = store.write_raw(discover.discover(fam, log=log), fam.key)
|
| 45 |
+
if args.push:
|
| 46 |
+
store.push([raw_path], f"{fam.key}: snapshot {raw_path.stem}")
|
| 47 |
+
raw = store.read_raw(fam.key)
|
| 48 |
+
today = raw[raw.day == raw.day.max()]
|
| 49 |
+
cache, cache_path = pipeline.enrich_all(today, fam, log=log)
|
| 50 |
+
labels = classify.classify_all(today, cache, fam)
|
| 51 |
+
|
| 52 |
+
lab_path = store.LOCAL / "labels" / fam.key / "latest.parquet"
|
| 53 |
+
lab_path.parent.mkdir(parents=True, exist_ok=True)
|
| 54 |
+
ldf = pd.DataFrame(labels)
|
| 55 |
+
for c in ("evidence", "flags"):
|
| 56 |
+
ldf[c] = ldf[c].apply(lambda v: json.dumps(v, ensure_ascii=False))
|
| 57 |
+
ldf.to_parquet(lab_path, index=False)
|
| 58 |
+
|
| 59 |
+
data = metrics.build(raw, labels, metrics.hf_tree_counts(today, fam), fam)
|
| 60 |
+
data_path = store.LOCAL / "dashboard" / f"{fam.key}.json"
|
| 61 |
+
metrics.dump(data, data_path)
|
| 62 |
+
log(f"{fam.key}: {len(labels)} labels, {len(data['repos'])} repos on the dashboard")
|
| 63 |
+
if args.push:
|
| 64 |
+
store.push([lab_path, cache_path], f"{fam.key}: labels {data['today']}")
|
| 65 |
+
api.upload_file(path_or_fileobj=str(data_path), path_in_repo=f"data/{fam.key}.json",
|
| 66 |
+
repo_id=SPACE_REPO, repo_type="space", commit_message=f"{fam.key}: data {data['today']}")
|
| 67 |
+
|
| 68 |
+
idx_path = store.LOCAL / "dashboard" / "index.json"
|
| 69 |
+
metrics.dump({"families": [{"key": f.key, "title": f.title} for f in families.FAMILIES.values()]}, idx_path)
|
| 70 |
+
if args.push:
|
| 71 |
+
api.upload_file(path_or_fileobj=str(idx_path), path_in_repo="data/index.json", repo_id=SPACE_REPO,
|
| 72 |
+
repo_type="space", commit_message="index")
|
| 73 |
+
log("pushed")
|
code/space/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: MiniMax-H3 开源生态
|
| 3 |
+
emoji: 📈
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: static
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
MiniMax-H3 家族(H3、H3-Image、H3-Image-PE)在 Hugging Face 上的下游仓库统计。数据每天由 HF Jobs 定时任务更新,原始快照在私有数据集 `MiniMaxAI/h3-ecosystem-data`。
|
code/space/index.html
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>MiniMax 开源生态</title>
|
| 7 |
+
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
color-scheme: light;
|
| 11 |
+
--page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
|
| 12 |
+
--grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11,11,11,0.10); --wash: #f0efec;
|
| 13 |
+
--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6;
|
| 14 |
+
--good: #006300; --warn-bg: #fff4dc; --accent: #2a78d6;
|
| 15 |
+
}
|
| 16 |
+
@media (prefers-color-scheme: dark) {
|
| 17 |
+
:root:not([data-theme="light"]) {
|
| 18 |
+
color-scheme: dark;
|
| 19 |
+
--page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
|
| 20 |
+
--grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10); --wash: #262624;
|
| 21 |
+
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9;
|
| 22 |
+
--good: #0ca30c; --warn-bg: #2e2614; --accent: #3987e5;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
:root[data-theme="dark"] {
|
| 26 |
+
color-scheme: dark;
|
| 27 |
+
--page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
|
| 28 |
+
--grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,0.10); --wash: #262624;
|
| 29 |
+
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9;
|
| 30 |
+
--good: #0ca30c; --warn-bg: #2e2614; --accent: #3987e5;
|
| 31 |
+
}
|
| 32 |
+
* { box-sizing: border-box; }
|
| 33 |
+
body { margin: 0; background: var(--page); color: var(--ink);
|
| 34 |
+
font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
|
| 35 |
+
.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 16px 64px; }
|
| 36 |
+
@media (max-width: 600px) { .tile .value { font-size: 26px; } .tile.hero .value { font-size: 40px; } .card { padding: 16px 14px; } }
|
| 37 |
+
header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
|
| 38 |
+
h1 { font-size: 26px; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
|
| 39 |
+
.sub { color: var(--ink2); font-size: 14px; }
|
| 40 |
+
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; padding: 3px; }
|
| 41 |
+
.seg button { border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: 15px; padding: 7px 16px; border-radius: 7px; cursor: pointer; }
|
| 42 |
+
.seg button[aria-pressed="true"] { background: var(--wash); color: var(--ink); font-weight: 600; }
|
| 43 |
+
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
| 44 |
+
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
|
| 45 |
+
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 16px 18px; }
|
| 46 |
+
.tile .label { color: var(--ink2); font-size: 14px; }
|
| 47 |
+
.tile .value { font-size: 30px; font-weight: 650; margin: 2px 0; }
|
| 48 |
+
.tile .note { color: var(--muted); font-size: 13.5px; }
|
| 49 |
+
.tile.hero .value { font-size: 48px; line-height: 1.1; }
|
| 50 |
+
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
|
| 51 |
+
.card h2 { font-size: 17px; margin: 0 0 2px; font-weight: 620; }
|
| 52 |
+
.card .desc { color: var(--ink2); font-size: 14px; margin: 0 0 12px; }
|
| 53 |
+
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
| 54 |
+
.row2 > *, .tiles > *, .card { min-width: 0; }
|
| 55 |
+
.seg { flex-wrap: wrap; }
|
| 56 |
+
@media (max-width: 900px) { .row2 { grid-template-columns: 1fr; } }
|
| 57 |
+
.chart { width: 100%; height: 300px; }
|
| 58 |
+
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 6px; font-size: 13.5px; color: var(--ink2); }
|
| 59 |
+
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
|
| 60 |
+
.empty { height: 300px; display: grid; place-items: center; color: var(--ink2); text-align: center; background: var(--wash); border-radius: 10px; font-size: 14.5px; padding: 0 20px; }
|
| 61 |
+
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
| 62 |
+
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
|
| 63 |
+
th { color: var(--ink2); font-weight: 560; white-space: nowrap; }
|
| 64 |
+
th.sortable { cursor: pointer; user-select: none; }
|
| 65 |
+
th.sortable:hover { color: var(--ink); }
|
| 66 |
+
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
| 67 |
+
tr.total td { font-weight: 620; border-bottom: 0; }
|
| 68 |
+
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
|
| 69 |
+
.tablewrap { overflow-x: auto; }
|
| 70 |
+
a { color: var(--accent); text-decoration: none; }
|
| 71 |
+
a:hover { text-decoration: underline; }
|
| 72 |
+
.repo { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; word-break: break-all; }
|
| 73 |
+
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--wash); color: var(--ink2); font-size: 13px; white-space: nowrap; }
|
| 74 |
+
.chip.warn { background: var(--warn-bg); color: var(--ink); }
|
| 75 |
+
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
|
| 76 |
+
#famSel, .filters input[type=search], .filters select { font: inherit; font-size: 14px; color: var(--ink); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 6px 10px; }
|
| 77 |
+
.filters input[type=search] { min-width: 240px; flex: 1; max-width: 380px; }
|
| 78 |
+
.filters label { color: var(--ink2); font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
|
| 79 |
+
details summary { cursor: pointer; color: var(--ink2); font-size: 13.5px; white-space: nowrap; }
|
| 80 |
+
details ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink2); font-size: 13.5px; }
|
| 81 |
+
.more { margin-top: 10px; font: inherit; font-size: 14px; background: var(--wash); color: var(--ink); border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; }
|
| 82 |
+
.method p { color: var(--ink2); font-size: 14px; margin: 6px 0; }
|
| 83 |
+
.method b { color: var(--ink); font-weight: 600; }
|
| 84 |
+
</style>
|
| 85 |
+
</head>
|
| 86 |
+
<body>
|
| 87 |
+
<div class="wrap">
|
| 88 |
+
<header>
|
| 89 |
+
<div>
|
| 90 |
+
<h1 id="title">MiniMax 开源生态</h1>
|
| 91 |
+
<div class="sub" id="asof">加载中…</div>
|
| 92 |
+
</div>
|
| 93 |
+
<div style="display:flex;gap:10px;flex-wrap:wrap;align-items:center">
|
| 94 |
+
<select id="famSel" aria-label="选择模型家族" hidden></select>
|
| 95 |
+
<div class="seg" role="group" aria-label="选择模型" id="lineageSeg"></div>
|
| 96 |
+
</div>
|
| 97 |
+
</header>
|
| 98 |
+
|
| 99 |
+
<div class="tiles" id="tiles"></div>
|
| 100 |
+
|
| 101 |
+
<div class="row2">
|
| 102 |
+
<section class="card">
|
| 103 |
+
<h2>衍生模型每日下载</h2>
|
| 104 |
+
<p class="desc">两次快照之间的下载增量,按关系类型堆叠。</p>
|
| 105 |
+
<div class="legend" data-legend></div>
|
| 106 |
+
<div id="dailyChart" class="chart"></div>
|
| 107 |
+
</section>
|
| 108 |
+
<section class="card">
|
| 109 |
+
<h2>每周新增衍生模型</h2>
|
| 110 |
+
<p class="desc">按仓库创建日期统计,可以看到发布以来的完整历史。</p>
|
| 111 |
+
<div class="legend" data-legend></div>
|
| 112 |
+
<div id="growthChart" class="chart"></div>
|
| 113 |
+
</section>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<section class="card">
|
| 117 |
+
<h2>按关系类型</h2>
|
| 118 |
+
<p class="desc">我们按权重内容识别的数字,和 HF Model tree 按声明显示的数字并排。HF 只有前四种关系,重打包、官方权重转存和配套组件在 HF 上会被算成 finetune 或者不显示。"整仓复制"指整个仓库的权重和别人更早的仓库逐字节相同,按内容照常归类,单独列出数量。</p>
|
| 119 |
+
<div class="tablewrap"><table id="relTable"></table></div>
|
| 120 |
+
</section>
|
| 121 |
+
|
| 122 |
+
<section class="card">
|
| 123 |
+
<h2>下载量最高的衍生模型</h2>
|
| 124 |
+
<p class="desc" id="concDesc"></p>
|
| 125 |
+
<div id="topChart" class="chart" style="height:380px"></div>
|
| 126 |
+
</section>
|
| 127 |
+
|
| 128 |
+
<section class="card">
|
| 129 |
+
<h2>全部仓库</h2>
|
| 130 |
+
<p class="desc">点开"依据"可以看到每个仓库为什么被这样归类。</p>
|
| 131 |
+
<div class="filters">
|
| 132 |
+
<input type="search" id="q" placeholder="搜索仓库名" aria-label="搜索仓库名">
|
| 133 |
+
<select id="fKind" aria-label="类型"><option value="">模型、Space、数据集</option><option value="model">模型</option><option value="space">Space</option><option value="dataset">数据集</option></select>
|
| 134 |
+
<select id="fRel" aria-label="关系"><option value="">全部关系</option></select>
|
| 135 |
+
<select id="fConf" aria-label="置信度"><option value="">全部置信度</option><option value="high">高</option><option value="medium">中</option><option value="low">低</option></select>
|
| 136 |
+
<select id="fDecl" aria-label="base_model 声明"><option value="">全部声明情况</option><option value="ok">声明正确</option><option value="missing">没写 base_model</option><option value="wrong_base">底模写错</option><option value="wrong_relation">关系写错</option></select>
|
| 137 |
+
<label><input type="checkbox" id="fCopy"> 隐藏整仓复制</label>
|
| 138 |
+
<label><input type="checkbox" id="fUnk"> 只看待确认</label>
|
| 139 |
+
<label><input type="checkbox" id="fNsfw"> 显示 NSFW</label>
|
| 140 |
+
</div>
|
| 141 |
+
<div class="tablewrap"><table id="repoTable"></table></div>
|
| 142 |
+
<button class="more" id="moreBtn" hidden>再显示 100 条</button>
|
| 143 |
+
</section>
|
| 144 |
+
|
| 145 |
+
<section class="card">
|
| 146 |
+
<h2 id="exclTitle">HF 算在这个模型下、但其实不是它的仓库</h2>
|
| 147 |
+
<p class="desc">这些仓库在 HF Model tree 里挂在当前模型下面,但权重或训练信息显示它们属于别的模型。</p>
|
| 148 |
+
<div class="tablewrap"><table id="exclTable"></table></div>
|
| 149 |
+
</section>
|
| 150 |
+
|
| 151 |
+
<section class="card method">
|
| 152 |
+
<h2>口径说明</h2>
|
| 153 |
+
<p><b>找仓库:</b>HF Model tree(逐层往下)、仓库名搜索、模型卡全文搜索、家族标签、调用了官方模型的 Space。故意收得宽,再由分类去掉无关的。</p>
|
| 154 |
+
<p><b>判断属于哪个模型:</b>先看权重本身(与官方文件哈希相同、完整权重里有没有某个成员独有的层,比如 H3 的音频分支和 H3-Image 的 PDD 头、抽查一层权重的数值与官方比对、LoRA 文件头里写的训练底模),��些能直接定案,置信度为"高"。没有这类证据时再看声明的 base_model、模型卡内容、仓库里有没有视频样例、创建时间(早于某个成员发布的仓库不可能基于它),置信度为"中"。只有名字能参考时为"低"。结构证据互相矛盾或分不清是哪个成员的,放进"待确认",不计入任何模型。</p>
|
| 155 |
+
<p><b>衍生模型:</b>LoRA 等适配器、微调、融合、量化、重打包、官方权重转存、配套组件(VAE、文本编码器等)。整仓复制别人社区仓库的,按内容归类并标为"复制"。只是给它用、权重来自别的模型的(比如基于普通 Qwen 的提示词改写模型)算周边工具,不算衍生模型。</p>
|
| 156 |
+
<p><b>每日下载:</b>HF 只公开每个仓库的累计下载和近 30 天下载,所以每天存一次快照,用相邻两天的累计下载相减。新出现的仓库第一天不计。</p>
|
| 157 |
+
<p id="verNote"></p>
|
| 158 |
+
</section>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<script>
|
| 162 |
+
const REL_NAME = {adapter: "适配器(LoRA 等)", finetune: "微调", quantized: "量化", repackage: "重打包", merge: "融合", mirror: "官方权重转存", component: "配套组件", tool: "周边工具", "no-weights": "工作流/代码", app: "Space 应用", dataset: "数据集", official: "官方"};
|
| 163 |
+
const CONF_NAME = {high: "高", medium: "中", low: "低"};
|
| 164 |
+
const DECL_NAME = {ok: "正确", missing: "没写", wrong_base: "底模写错", wrong_relation: "关系写错"};
|
| 165 |
+
let LIN_NAME = {unknown: "待确认", unrelated: "无关"};
|
| 166 |
+
const css = n => getComputedStyle(document.documentElement).getPropertyValue(n).trim();
|
| 167 |
+
const fmt = n => n == null ? "–" : n >= 1e6 ? (n / 1e6).toFixed(n >= 1e7 ? 1 : 2).replace(/\.?0+$/, "") + "M" : n >= 1e4 ? (n / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : n.toLocaleString("en-US");
|
| 168 |
+
const full = n => n == null ? "–" : n.toLocaleString("en-US");
|
| 169 |
+
let D, lineage, charts = {}, shown = 100, sortKey = "dl30", sortDir = -1, inited = false;
|
| 170 |
+
|
| 171 |
+
function relColor(rel) { return css("--s" + (D.rel_order.indexOf(rel) + 1)); }
|
| 172 |
+
function esc(s) { return String(s).replace(/[&<>"]/g, c => ({"&": "&", "<": "<", ">": ">", '"': """}[c])); }
|
| 173 |
+
|
| 174 |
+
fetch("data/index.json").then(r => r.json()).then(idx => {
|
| 175 |
+
const sel = document.getElementById("famSel");
|
| 176 |
+
sel.innerHTML = idx.families.map(f => `<option value="${f.key}">${esc(f.title)}</option>`).join("");
|
| 177 |
+
sel.hidden = idx.families.length < 2;
|
| 178 |
+
const want = location.hash.slice(1);
|
| 179 |
+
sel.value = idx.families.some(f => f.key === want) ? want : idx.families[0].key;
|
| 180 |
+
sel.onchange = () => { location.hash = sel.value; loadFamily(sel.value); };
|
| 181 |
+
loadFamily(sel.value);
|
| 182 |
+
});
|
| 183 |
+
|
| 184 |
+
function loadFamily(key) {
|
| 185 |
+
fetch(`data/${key}.json`).then(r => r.json()).then(d => {
|
| 186 |
+
D = d; shown = 100;
|
| 187 |
+
LIN_NAME = {unknown: "待确认", unrelated: "无关"};
|
| 188 |
+
for (const m of d.family.members) LIN_NAME[m.lineage] = m.base.split("/")[1];
|
| 189 |
+
lineage = d.family.members[0].lineage;
|
| 190 |
+
document.title = `${d.family.title}开源生态`;
|
| 191 |
+
document.getElementById("title").textContent = `${d.family.title}开源生态`;
|
| 192 |
+
document.getElementById("asof").textContent = `数据日期 ${d.today}(UTC) · 已记录 ${d.snapshot_days.length} 天快照 · 每天自动更新`;
|
| 193 |
+
document.getElementById("verNote").textContent = `分类规则版本 ${d.classifier_version},生成于 ${d.generated_at.replace("T", " ").replace("+00:00", " UTC")}。`;
|
| 194 |
+
const seg = document.getElementById("lineageSeg");
|
| 195 |
+
seg.innerHTML = "";
|
| 196 |
+
for (const m of d.family.members) {
|
| 197 |
+
const b = document.createElement("button");
|
| 198 |
+
b.textContent = LIN_NAME[m.lineage]; b.dataset.k = m.lineage; b.setAttribute("aria-pressed", m.lineage === lineage);
|
| 199 |
+
b.onclick = () => { lineage = m.lineage; shown = 100; seg.querySelectorAll("button").forEach(x => x.setAttribute("aria-pressed", x.dataset.k === lineage)); render(); };
|
| 200 |
+
seg.appendChild(b);
|
| 201 |
+
}
|
| 202 |
+
const rs = document.getElementById("fRel");
|
| 203 |
+
rs.innerHTML = `<option value="">全部关系</option>` + [...d.rel_order, "tool", "no-weights", "app", "dataset"].map(k => `<option value="${k}">${REL_NAME[k]}</option>`).join("");
|
| 204 |
+
if (!inited) {
|
| 205 |
+
inited = true;
|
| 206 |
+
for (const id of ["q", "fKind", "fRel", "fConf", "fDecl", "fNsfw", "fUnk", "fCopy"]) document.getElementById(id).addEventListener("input", () => { shown = 100; renderRepos(); });
|
| 207 |
+
document.getElementById("moreBtn").onclick = () => { shown += 100; renderRepos(); };
|
| 208 |
+
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", render);
|
| 209 |
+
new MutationObserver(render).observe(document.documentElement, {attributes: true, attributeFilter: ["data-theme"]});
|
| 210 |
+
addEventListener("resize", () => Object.values(charts).forEach(c => c.resize()));
|
| 211 |
+
}
|
| 212 |
+
render();
|
| 213 |
+
});
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
function render() { renderTiles(); renderLegends(); renderDaily(); renderGrowth(); renderRel(); renderTop(); renderRepos(); renderExcl(); }
|
| 217 |
+
|
| 218 |
+
function L() { return D.lineages[lineage]; }
|
| 219 |
+
|
| 220 |
+
function renderTiles() {
|
| 221 |
+
const l = L(), hf = Object.values(l.hf_tree).reduce((a, b) => a + b, 0);
|
| 222 |
+
const miss = (l.declared.missing || 0) + (l.declared.wrong_base || 0);
|
| 223 |
+
const tiles = [
|
| 224 |
+
{label: "衍生模型", value: full(l.n_models), note: `HF Model tree 只显示 ${full(hf)} 个`, hero: true},
|
| 225 |
+
{label: "衍生模型近 30 天下载", value: fmt(l.dl30), note: `官方仓库 ${fmt(l.official.dl30)}`},
|
| 226 |
+
{label: "衍生模型累计下载", value: fmt(l.dlall), note: `官方仓库 ${fmt(l.official.dlall)}`},
|
| 227 |
+
{label: "用到它的 Space", value: full(l.n_spaces), note: `另有数据集 ${l.n_datasets} 个、周边工具 ${l.n_tools} 个`},
|
| 228 |
+
{label: "base_model 没写或写错", value: full(miss), note: `占衍生模型的 ${l.n_models ? Math.round(miss / l.n_models * 100) : 0}%,可以提 PR 补上`},
|
| 229 |
+
];
|
| 230 |
+
document.getElementById("tiles").innerHTML = tiles.map(t => `<div class="tile${t.hero ? " hero" : ""}"><div class="label">${t.label}</div><div class="value">${t.value}</div><div class="note">${t.note}</div></div>`).join("");
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
function renderLegends() {
|
| 234 |
+
const html = D.rel_order.filter(r => L().by_relation[r].n > 0).map(r => `<span><i style="background:${relColor(r)}"></i>${REL_NAME[r]}</span>`).join("");
|
| 235 |
+
document.querySelectorAll("[data-legend]").forEach(el => el.innerHTML = html);
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
function baseOpts() {
|
| 239 |
+
return {
|
| 240 |
+
animation: false, textStyle: {fontFamily: "system-ui, -apple-system, 'Segoe UI', 'PingFang SC', sans-serif"},
|
| 241 |
+
grid: {left: 8, right: 16, top: 12, bottom: 4, containLabel: true},
|
| 242 |
+
tooltip: {trigger: "axis", axisPointer: {type: "line", lineStyle: {color: css("--axis")}},
|
| 243 |
+
backgroundColor: css("--surface"), borderColor: css("--ring"), textStyle: {color: css("--ink"), fontSize: 13},
|
| 244 |
+
valueFormatter: v => full(v)},
|
| 245 |
+
xAxis: {type: "category", axisLine: {lineStyle: {color: css("--axis")}}, axisTick: {show: false}, axisLabel: {color: css("--muted"), fontSize: 12}},
|
| 246 |
+
yAxis: {type: "value", splitLine: {lineStyle: {color: css("--grid")}}, axisLabel: {color: css("--muted"), fontSize: 12, formatter: v => fmt(v)}},
|
| 247 |
+
};
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
function chart(id) {
|
| 251 |
+
const el = document.getElementById(id);
|
| 252 |
+
if (charts[id]) { charts[id].dispose(); delete charts[id]; }
|
| 253 |
+
return charts[id] = echarts.init(el, null, {renderer: "svg"});
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
function stacked(id, xs, byRel) {
|
| 257 |
+
const rels = D.rel_order.filter(r => byRel[r] && byRel[r].some(v => v));
|
| 258 |
+
const o = baseOpts();
|
| 259 |
+
o.xAxis.data = xs;
|
| 260 |
+
o.series = rels.map((r, i) => ({name: REL_NAME[r], type: "bar", stack: "s", barMaxWidth: 24, data: byRel[r],
|
| 261 |
+
itemStyle: {color: relColor(r), borderColor: css("--surface"), borderWidth: 1,
|
| 262 |
+
borderRadius: i === rels.length - 1 ? [4, 4, 0, 0] : 0}, emphasis: {disabled: true}}));
|
| 263 |
+
chart(id).setOption(o);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
function renderDaily() {
|
| 267 |
+
const el = document.getElementById("dailyChart"), l = L();
|
| 268 |
+
const days = [...new Set(l.daily.map(r => r.day))].sort();
|
| 269 |
+
if (days.length === 0) {
|
| 270 |
+
if (charts.dailyChart) { charts.dailyChart.dispose(); delete charts.dailyChart; }
|
| 271 |
+
el.innerHTML = `<div class="empty">从 ${D.snapshot_days[0]} 开始每天记录快照。<br>每日下载要用相邻两天相减,第二次快照之后这里开始出数。</div>`;
|
| 272 |
+
return;
|
| 273 |
+
}
|
| 274 |
+
el.innerHTML = "";
|
| 275 |
+
const byRel = {};
|
| 276 |
+
for (const r of D.rel_order) byRel[r] = days.map(d => (l.daily.find(x => x.day === d && x.relation === r) || {}).daily || 0);
|
| 277 |
+
stacked("dailyChart", days, byRel);
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
function renderGrowth() {
|
| 281 |
+
const l = L();
|
| 282 |
+
const wk = s => { const d = new Date(s + "T00:00:00Z"); const k = (d.getUTCDay() + 6) % 7; d.setUTCDate(d.getUTCDate() - k); return d.toISOString().slice(0, 10); };
|
| 283 |
+
const weeks = {};
|
| 284 |
+
for (const g of l.growth) { const w = wk(g.date); (weeks[w] ||= {})[g.relation] = ((weeks[w] || {})[g.relation] || 0) + g.n; }
|
| 285 |
+
const xs = Object.keys(weeks).sort();
|
| 286 |
+
if (xs.length) { // fill missing weeks
|
| 287 |
+
const all = []; for (let d = new Date(xs[0] + "T00:00:00Z"); d <= new Date(xs.at(-1) + "T00:00:00Z"); d.setUTCDate(d.getUTCDate() + 7)) all.push(d.toISOString().slice(0, 10));
|
| 288 |
+
xs.splice(0, xs.length, ...all);
|
| 289 |
+
}
|
| 290 |
+
const byRel = {};
|
| 291 |
+
for (const r of D.rel_order) byRel[r] = xs.map(w => (weeks[w] || {})[r] || 0);
|
| 292 |
+
stacked("growthChart", xs.map(x => x.slice(5)), byRel);
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
function renderRel() {
|
| 296 |
+
const l = L(); let tn = 0, t30 = 0, ta = 0, th = 0;
|
| 297 |
+
let tc = 0;
|
| 298 |
+
let h = `<thead><tr><th>关系</th><th class="num">我们识别</th><th class="num">其中整仓复制</th><th class="num">近 30 天下载</th><th class="num">累计下载</th><th class="num">HF Model tree 显示</th></tr></thead><tbody>`;
|
| 299 |
+
for (const r of D.rel_order) {
|
| 300 |
+
const b = l.by_relation[r], hf = l.hf_tree[r];
|
| 301 |
+
tn += b.n; t30 += b.dl30; ta += b.dlall; th += hf || 0; tc += r === "mirror" ? 0 : (b.copies || 0);
|
| 302 |
+
h += `<tr><td><span class="sw" style="background:${relColor(r)}"></span>${REL_NAME[r]}</td><td class="num">${full(b.n)}</td><td class="num">${r === "mirror" ? "—" : full(b.copies)}</td><td class="num">${full(b.dl30)}</td><td class="num">${full(b.dlall)}</td><td class="num">${hf == null ? "—" : full(hf)}</td></tr>`;
|
| 303 |
+
}
|
| 304 |
+
h += `<tr class="total"><td>合计</td><td class="num">${full(tn)}</td><td class="num">${full(tc)}</td><td class="num">${full(t30)}</td><td class="num">${full(ta)}</td><td class="num">${full(th)}</td></tr></tbody>`;
|
| 305 |
+
const unk = D.unknown_family ? `<tr><td colspan="6" style="color:var(--ink2);border:0;padding-top:12px">另有 ${D.unknown_family} 个仓库看得出属于这个家族、但分不清是哪个模型,放在"待确认",没有计入上表。</td></tr>` : "";
|
| 306 |
+
document.getElementById("relTable").innerHTML = h + unk;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
function renderTop() {
|
| 310 |
+
const l = L();
|
| 311 |
+
const rows = D.repos.filter(r => r.lineage === lineage && r.kind === "model" && D.rel_order.includes(r.relation) && r.dl30)
|
| 312 |
+
.sort((a, b) => b.dl30 - a.dl30);
|
| 313 |
+
const top = rows.slice(0, 10).reverse();
|
| 314 |
+
const share = l.dl30 ? rows.slice(0, 1).reduce((a, r) => a + r.dl30, 0) / l.dl30 : 0;
|
| 315 |
+
const share10 = l.dl30 ? rows.slice(0, 10).reduce((a, r) => a + r.dl30, 0) / l.dl30 : 0;
|
| 316 |
+
document.getElementById("concDesc").textContent = rows.length
|
| 317 |
+
? `近 30 天下载。第一名占全部衍生模型下载的 ${Math.round(share * 100)}%,前十名占 ${Math.round(share10 * 100)}%,看总量时要注意头部集中。`
|
| 318 |
+
: "暂无数据。";
|
| 319 |
+
const o = baseOpts();
|
| 320 |
+
o.tooltip = {...o.tooltip, trigger: "item", formatter: p => `${esc(p.name)}<br>${REL_NAME[top[p.dataIndex].relation]} · 近 30 天 ${full(p.value)}`};
|
| 321 |
+
o.grid = {left: 8, right: 64, top: 4, bottom: 4, containLabel: true};
|
| 322 |
+
o.xAxis = {type: "value", show: false};
|
| 323 |
+
o.yAxis = {type: "category", data: top.map(r => r.id), axisLine: {show: false}, axisTick: {show: false},
|
| 324 |
+
axisLabel: {color: css("--ink2"), fontSize: 12.5, width: Math.min(330, document.getElementById("topChart").clientWidth * 0.42), overflow: "truncate"}};
|
| 325 |
+
o.series = [{type: "bar", barMaxWidth: 20, data: top.map(r => ({value: r.dl30, itemStyle: {color: relColor(r.relation), borderRadius: [0, 4, 4, 0]}})),
|
| 326 |
+
label: {show: true, position: "right", color: css("--ink2"), fontSize: 12.5, formatter: p => fmt(p.value)}}];
|
| 327 |
+
chart("topChart").setOption(o);
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
function filtered() {
|
| 331 |
+
const q = document.getElementById("q").value.trim().toLowerCase();
|
| 332 |
+
const k = document.getElementById("fKind").value, rel = document.getElementById("fRel").value;
|
| 333 |
+
const conf = document.getElementById("fConf").value, decl = document.getElementById("fDecl").value;
|
| 334 |
+
const nsfw = document.getElementById("fNsfw").checked, unk = document.getElementById("fUnk").checked;
|
| 335 |
+
const hideCopy = document.getElementById("fCopy").checked;
|
| 336 |
+
return D.repos.filter(r => r.relation !== "official" && (unk ? r.lineage === "unknown" : r.lineage === lineage)
|
| 337 |
+
&& (!q || r.id.toLowerCase().includes(q)) && (!k || r.kind === k) && (!rel || r.relation === rel)
|
| 338 |
+
&& (!conf || r.conf === conf) && (!decl || r.declared === decl) && (nsfw || !r.flags.includes("nsfw"))
|
| 339 |
+
&& (!hideCopy || !r.copy_of));
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
function renderRepos() {
|
| 343 |
+
const rows = filtered().sort((a, b) => {
|
| 344 |
+
const x = a[sortKey], y = b[sortKey];
|
| 345 |
+
return (x == null) - (y == null) || (x < y ? -1 : x > y ? 1 : 0) * sortDir;
|
| 346 |
+
});
|
| 347 |
+
const hasDaily = D.snapshot_days.length > 1;
|
| 348 |
+
const cols = [["id", "仓库"], ["relation", "关系"], ["conf", "置信度"], ["dl30", "近 30 天", 1], ["dlall", "累计", 1], ...(hasDaily ? [["d1", "最近一天", 1]] : []), ["created", "创建"], ["declared", "base_model"]];
|
| 349 |
+
let h = "<thead><tr>" + cols.map(([k, n, num]) => `<th class="sortable${num ? " num" : ""}" data-k="${k}">${n}${sortKey === k ? (sortDir < 0 ? " ↓" : " ↑") : ""}</th>`).join("") + "<th>依据</th></tr></thead><tbody>";
|
| 350 |
+
for (const r of rows.slice(0, shown)) {
|
| 351 |
+
const url = "https://huggingface.co/" + (r.kind === "space" ? "spaces/" : r.kind === "dataset" ? "datasets/" : "") + r.id;
|
| 352 |
+
const dec = r.declared ? `<span class="chip${r.declared === "ok" ? "" : " warn"}">${DECL_NAME[r.declared]}</span>` : "";
|
| 353 |
+
const sw = D.rel_order.includes(r.relation) ? `<span class="sw" style="background:${relColor(r.relation)}"></span>` : "";
|
| 354 |
+
h += `<tr><td class="repo"><a href="${url}" target="_blank" rel="noopener">${esc(r.id)}</a>${r.copy_of ? ` <span class="chip" title="复制自 ${esc(r.copy_of)}">复制</span>` : ""}${r.flags.includes("nsfw") ? ' <span class="chip">NSFW</span>' : ""}</td>
|
| 355 |
+
<td style="white-space:nowrap">${sw}${REL_NAME[r.relation] || "–"}</td><td>${CONF_NAME[r.conf] || "–"}</td>
|
| 356 |
+
<td class="num">${full(r.dl30)}</td><td class="num">${full(r.dlall)}</td>${hasDaily ? `<td class="num">${full(r.d1)}</td>` : ""}<td style="white-space:nowrap">${r.created}</td><td>${dec}</td>
|
| 357 |
+
<td><details><summary>${r.evidence.length} 条</summary><ul>${r.evidence.map(e => `<li>${esc(e)}</li>`).join("")}</ul></details></td></tr>`;
|
| 358 |
+
}
|
| 359 |
+
h += "</tbody>";
|
| 360 |
+
const t = document.getElementById("repoTable");
|
| 361 |
+
t.innerHTML = h;
|
| 362 |
+
t.querySelectorAll("th.sortable").forEach(th => th.onclick = () => { const k = th.dataset.k; sortDir = sortKey === k ? -sortDir : -1; sortKey = k; renderRepos(); });
|
| 363 |
+
const btn = document.getElementById("moreBtn");
|
| 364 |
+
btn.hidden = rows.length <= shown;
|
| 365 |
+
btn.textContent = `再显示 100 条(共 ${rows.length} 条)`;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
function renderExcl() {
|
| 369 |
+
const rows = D.repos.filter(r => r.hf_under === lineage && r.lineage !== lineage)
|
| 370 |
+
.sort((a, b) => (b.dl30 || 0) - (a.dl30 || 0));
|
| 371 |
+
document.getElementById("exclTitle").textContent = `HF 算在 ${LIN_NAME[lineage]} 下、但其实不是它的仓库(${rows.length} 个)`;
|
| 372 |
+
let h = `<thead><tr><th>仓库</th><th>实际属于</th><th>关系</th><th class="num">近 30 天</th><th>依据</th></tr></thead><tbody>`;
|
| 373 |
+
for (const r of rows) h += `<tr><td class="repo"><a href="https://huggingface.co/${r.id}" target="_blank" rel="noopener">${esc(r.id)}</a></td><td>${LIN_NAME[r.lineage] || r.lineage}</td><td>${REL_NAME[r.relation] || "–"}</td><td class="num">${full(r.dl30)}</td><td><details><summary>${r.evidence.length} 条</summary><ul>${r.evidence.map(e => `<li>${esc(e)}</li>`).join("")}</ul></details></td></tr>`;
|
| 374 |
+
if (!rows.length) h += `<tr><td colspan="5" style="color:var(--ink2)">没有。</td></tr>`;
|
| 375 |
+
document.getElementById("exclTable").innerHTML = h + "</tbody>";
|
| 376 |
+
}
|
| 377 |
+
</script>
|
| 378 |
+
</body>
|
| 379 |
+
</html>
|
labels/h3/latest.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ec2e910842b6fff2eda575195ca5a8633db68bde638ab79bdf132376c3c08b4
|
| 3 |
+
size 171484
|