code: sync from git
Browse files- code/README.md +7 -4
- code/hfeco/classify.py +118 -27
- code/hfeco/enrich.py +51 -13
- code/hfeco/families/__init__.py +10 -2
- code/hfeco/families/m.py +80 -0
- code/hfeco/families/m_reference.json +0 -0
- code/hfeco/families/music.py +39 -0
- code/hfeco/families/music_reference.json +1 -0
- code/hfeco/family.py +46 -9
- code/hfeco/metrics.py +12 -3
- code/hfeco/org.py +12 -11
- code/scripts/build_reference.py +3 -3
- code/scripts/daily.py +13 -2
code/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
- 看板:公开 Space `MiniMaxAI/ecosystem`(2026-11-18 公开),英文落地页(静态页面,数据每天更新)。直接链接:https://minimaxai-ecosystem.static.hf.space/index.html
|
| 6 |
- 首页:全部公开发布的社区规模曲线(发布节点钉在曲线上)、发布卡片、按模态分块(Video / Language / Image / Music)
|
| 7 |
- 分类页 `#/<模态>/<发布>`:社区模型增长、类型、作者、全部模型列表、气泡图
|
| 8 |
-
-
|
| 9 |
- 数据:私有数据集 `MiniMaxAI/oss-ecosystem-data`
|
| 10 |
- 定时任务:HF Jobs,`MiniMaxAI` 名下,每天 00:30 UTC(scheduled job `6afda8a6545f95df1c063466`,cpu-basic,超时 2h)。
|
| 11 |
密钥 `HF_TOKEN` 是 saladday1 的写 token(用户同意的)。启动命令只做一件事:从数据集的 `code/` 拉最新代码再跑 `scripts/job.sh`,
|
|
@@ -15,8 +15,11 @@
|
|
| 15 |
|
| 16 |
```
|
| 17 |
hfeco/ 通用流水线,不含任何具体模型的知识
|
| 18 |
-
family.py 一个
|
| 19 |
-
families/
|
|
|
|
|
|
|
|
|
|
| 20 |
discover.py 找候选仓库(Model tree 逐层往下、名字、标签、模型卡全文、Space)
|
| 21 |
enrich.py 只读文件头和少量字节收集证据(不下载权重)
|
| 22 |
classify.py 三档证据判定:属于哪个成员、什么关系、base_model 声明对不对
|
|
@@ -53,7 +56,7 @@ raw/hubstats.parquet 历史累计下载(day, repo_id, d30, dla)
|
|
| 53 |
|
| 54 |
## 加一个模型家族
|
| 55 |
|
| 56 |
-
1. 写 `hfeco/families/<key>.py`,按 `family.py` 的字段填:成员和官方仓库、搜索词、能区分成员的结构指纹(独有的层、
|
| 57 |
2. 在 `hfeco/families/__init__.py` 里注册。
|
| 58 |
3. `python scripts/build_reference.py --family <key>` 生成官方参考数据。
|
| 59 |
4. `python scripts/daily.py --family <key>` 试跑,用 `eval/` 的方法抽样核对准确率。
|
|
|
|
| 5 |
- 看板:公开 Space `MiniMaxAI/ecosystem`(2026-11-18 公开),英文落地页(静态页面,数据每天更新)。直接链接:https://minimaxai-ecosystem.static.hf.space/index.html
|
| 6 |
- 首页:全部公开发布的社区规模曲线(发布节点钉在曲线上)、发布卡片、按模态分块(Video / Language / Image / Music)
|
| 7 |
- 分类页 `#/<模态>/<发布>`:社区模型增长、类型、作者、全部模型列表、气泡图
|
| 8 |
+
- 每个系列有自己的分类器(`hfeco/families/`),连没声明 base_model 的仓库也找;只有 SynLogic、VTP 沿 HF 的 base_model 标签逐层往下找(和 Model tree 一样,只算声明了的)
|
| 9 |
- 数据:私有数据集 `MiniMaxAI/oss-ecosystem-data`
|
| 10 |
- 定时任务:HF Jobs,`MiniMaxAI` 名下,每天 00:30 UTC(scheduled job `6afda8a6545f95df1c063466`,cpu-basic,超时 2h)。
|
| 11 |
密钥 `HF_TOKEN` 是 saladday1 的写 token(用户同意的)。启动命令只做一件事:从数据集的 `code/` 拉最新代码再跑 `scripts/job.sh`,
|
|
|
|
| 15 |
|
| 16 |
```
|
| 17 |
hfeco/ 通用流水线,不含任何具体模型的知识
|
| 18 |
+
family.py 一个系列需要提供什么(成员、搜索词、结构指纹、元数据规则……),三层证据的说明
|
| 19 |
+
families/ 一个系列一个文件,都填 family.py 的同一组字段;<key>_reference.json 是官方文件哈希和抽查数值
|
| 20 |
+
h3.py 视频 + 图像:H3、H3-Image(H3-Image-PE 照常分类但不展示)。DiT 形状、音频分支 / PDD 头、训练元数据、抽查数值
|
| 21 |
+
m.py 语言:Text-01、VL-01、M1、M2 … M2.7、M3、M3.1-Flash。config / GGUF 里的架构名和 hidden size,同架构内按声明、GGUF 头、版本号、日期分
|
| 22 |
+
music.py 音乐:Music3。整套管线的架构名、DiT 的张量形状、语言模型的 20 万词表、整仓哈希
|
| 23 |
discover.py 找候选仓库(Model tree 逐层往下、名字、标签、模型卡全文、Space)
|
| 24 |
enrich.py 只读文件头和少量字节收集证据(不下载权重)
|
| 25 |
classify.py 三档证据判定:属于哪个成员、什么关系、base_model 声明对不对
|
|
|
|
| 56 |
|
| 57 |
## 加一个模型家族
|
| 58 |
|
| 59 |
+
1. 写 `hfeco/families/<key>.py`,按 `family.py` 的字段填:成员和官方仓库、搜索词、能区分成员的结构指纹(独有的层、`archs` 里 config / GGUF 的架构名和尺寸、训练元数据里的字样)、抽查用的张量名。成员本身是语言模型(或带着自己的语言模型,如 Music3)的写 `own_llm=True`。只用来区分、不需要展示的成员(比如 H3 家族的 H3-Image-PE)写 `tracked=False`:照常分类,好把它的衍生品从别的成员里排除,但不上看板、不进 PR 候选。
|
| 60 |
2. 在 `hfeco/families/__init__.py` 里注册。
|
| 61 |
3. `python scripts/build_reference.py --family <key>` 生成官方参考数据。
|
| 62 |
4. `python scripts/daily.py --family <key>` 试跑,用 `eval/` 的方法抽样核对准确率。
|
code/hfeco/classify.py
CHANGED
|
@@ -16,7 +16,10 @@ import re
|
|
| 16 |
|
| 17 |
import numpy as np
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 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)
|
|
@@ -94,7 +97,7 @@ def probe_match(probe, fam):
|
|
| 94 |
|
| 95 |
def sha_mirror(files, fam):
|
| 96 |
wb = [f for f in files or [] if f.get("sha256") and f.get("size", 0) > 1_000_000
|
| 97 |
-
and f["name"]
|
| 98 |
if not wb:
|
| 99 |
return None
|
| 100 |
total = sum(f["size"] for f in wb)
|
|
@@ -111,6 +114,41 @@ def sha_mirror(files, fam):
|
|
| 111 |
return lin, any_b / total
|
| 112 |
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
def _res(lineage, relation, family, confidence, evidence, flags):
|
| 115 |
return dict(lineage=lineage, relation=relation, family=family, confidence=confidence,
|
| 116 |
evidence=evidence, flags=flags, copy_of=None)
|
|
@@ -165,6 +203,9 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 165 |
readable = bool(keys.get("n")) or bool(ev.get("gguf"))
|
| 166 |
mi = json.dumps(ev.get("model_index") or {})
|
| 167 |
ctx = {"markers": markers, "sig": sig, "is_dit": is_dit, "is_lora": is_lora}
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
# ---- Tier 1: structural evidence --------------------------------------------------
|
| 170 |
mirror = sha_mirror(files, fam)
|
|
@@ -187,10 +228,13 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 187 |
if sub in mi:
|
| 188 |
t1(lin, f"model_index.json 是 {lin} 的管线")
|
| 189 |
break
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
| 194 |
created = str(r.get("created_at") or "")
|
| 195 |
if meta not in ("{}", ""):
|
| 196 |
for rx, lin, why in fam.meta_rules:
|
|
@@ -214,6 +258,13 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 214 |
if decl:
|
| 215 |
score[decl] += 5
|
| 216 |
E.append(f"声明的 base_model 指向 {decl}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
video_member = next((m.lineage for m in fam.members if m.modality == "video"), None)
|
| 218 |
if video_member and ev.get("has_video_media") and not is_text_llm:
|
| 219 |
score[video_member] += 3
|
|
@@ -224,7 +275,7 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 224 |
score[lin] += w
|
| 225 |
E.append(why)
|
| 226 |
member_hit = member_hit or lin != fam.default_member
|
| 227 |
-
if fam.family_text and fam.family_text.search(readme) and not member_hit:
|
| 228 |
score[fam.default_member] += 2
|
| 229 |
pt = r.get("pipeline_tag") or ""
|
| 230 |
for m in fam.members:
|
|
@@ -244,12 +295,12 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 244 |
for m in fam.members:
|
| 245 |
if m.text_hint and m.text_hint.search(name):
|
| 246 |
score[m.lineage] += 1.5
|
| 247 |
-
if fam.family_text and fam.family_text.search(name):
|
| 248 |
score[fam.default_member] += 1
|
| 249 |
|
| 250 |
# ---- Family gate -------------------------------------------------------------------
|
| 251 |
fam_text = bool(fam.family_text and fam.family_text.search(text)) or any(
|
| 252 |
-
m.text_hint and m.text_hint.search(text) for m in fam.members if m.
|
| 253 |
name_fam = bool(fam.family_text and fam.family_text.search(name)) or any(
|
| 254 |
m.text_hint and m.text_hint.search(name) for m in fam.members)
|
| 255 |
if other_dit and is_lora and not tier1 and not decl:
|
|
@@ -257,15 +308,20 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 257 |
component_for_family = bool(fam_text and fam.component_names and fam.component_names.search(name))
|
| 258 |
if other_dit and not tier1 and not decl and not name_fam and not component_for_family:
|
| 259 |
return _res("unrelated", None, False, "high", ["是别的模型的权重(层的尺寸不对),名字也没提到这个家族"], flags)
|
|
|
|
|
|
|
| 260 |
author_hint = bool(fam.name_hint and fam.name_hint.search(name) and r["author"] in AUTHORS.get(fam.key, ()))
|
| 261 |
-
if not (decl or tier1 or is_dit or fam_text or author_hint):
|
| 262 |
return _res("unrelated", None, False, "medium", ["没有任何相关信号"], flags)
|
| 263 |
-
if author_hint and not (decl or tier1 or is_dit or fam_text):
|
| 264 |
E.append("作者发布过这个家族的衍生模型,名字里也有家族关键词")
|
| 265 |
-
|
|
|
|
| 266 |
|
| 267 |
# ---- Decide lineage ----------------------------------------------------------------
|
| 268 |
-
|
|
|
|
|
|
|
| 269 |
if tier1:
|
| 270 |
if len(tier1) == 1:
|
| 271 |
lineage, conf = next(iter(tier1)), "high"
|
|
@@ -278,11 +334,11 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 278 |
else:
|
| 279 |
lineage, conf = "unknown", "low"
|
| 280 |
E.append("结构证据互相矛盾:" + " / ".join(tier1))
|
| 281 |
-
elif
|
| 282 |
lineage, conf = possible[0], "medium"
|
| 283 |
-
E.append(f"结构是这个家族的 DiT,且创建时只有 {possible[0]} 已发布")
|
| 284 |
else:
|
| 285 |
-
ranked = sorted(score.items(), key=lambda x: -x[1])
|
| 286 |
(l1, s1), (_, s2) = ranked[0], ranked[1]
|
| 287 |
if s1 >= 4 and s1 - s2 >= 3:
|
| 288 |
lineage, conf = l1, "medium"
|
|
@@ -297,14 +353,17 @@ def classify_model(r, ev, g, cutoff, fam):
|
|
| 297 |
if copy_of:
|
| 298 |
flags.append("copy")
|
| 299 |
E.append(f"整仓权重与更早的 {copy_of} 逐字节相同,是重新上传")
|
| 300 |
-
|
| 301 |
-
|
|
|
|
|
|
|
| 302 |
if rel == "tool" and not (decl or name_fam or component_for_family):
|
| 303 |
# Weights from another model and only the card mentions the family: an ad, a comparison,
|
| 304 |
# or training data made with it. Not part of the ecosystem count.
|
| 305 |
return _res("unrelated", None, False, "medium", ["权重来自别的模型,只在模型卡里提到这个家族"], flags)
|
| 306 |
if rel == "tool":
|
| 307 |
-
E.append("权重
|
|
|
|
| 308 |
if DISTILL_NAME.search(name) and rel in ("finetune", "adapter", "merge", "quantized"):
|
| 309 |
flags.append("distilled")
|
| 310 |
out = _res(lineage, rel, True, conf, E, flags)
|
|
@@ -317,13 +376,16 @@ def relation(r, ev, is_lora, is_family_weights, is_text_llm, mirror, pm, name, E
|
|
| 317 |
wbytes = ev.get("weight_bytes", 0)
|
| 318 |
card = ev.get("card") or {}
|
| 319 |
main = ev.get("main_weight") or ""
|
|
|
|
|
|
|
|
|
|
| 320 |
if ev.get("n_weight_files", 0) == 0 or wbytes < 1_000_000:
|
| 321 |
return "no-weights"
|
| 322 |
if mirror and mirror[1] >= 0.9:
|
| 323 |
return "mirror"
|
| 324 |
if is_text_llm and not pe_like:
|
| 325 |
if fam.text_component and fam.text_component.search(name + " " + json.dumps(ev.get("config"))):
|
| 326 |
-
E.append(
|
| 327 |
return "component"
|
| 328 |
return "tool"
|
| 329 |
if not is_family_weights and not pe_like:
|
|
@@ -365,13 +427,11 @@ def relation(r, ev, is_lora, is_family_weights, is_text_llm, mirror, pm, name, E
|
|
| 365 |
return "finetune"
|
| 366 |
|
| 367 |
|
| 368 |
-
WEIGHT_EXT = (".safetensors", ".gguf", ".bin", ".pt", ".pth", ".ckpt", ".onnx", ".npz", ".sft", ".tflite",
|
| 369 |
-
".mlmodel", ".engine", ".pte")
|
| 370 |
|
| 371 |
|
| 372 |
def _weights(ev):
|
| 373 |
return {f["sha256"]: f["size"] for f in (ev or {}).get("files", [])
|
| 374 |
-
if f.get("sha256") and f.get("size", 0) > 1_000_000 and f["name"]
|
| 375 |
|
| 376 |
|
| 377 |
def community_mirror(r, ev, fam):
|
|
@@ -428,13 +488,13 @@ def classify_dataset(r, fam):
|
|
| 428 |
|
| 429 |
def _text_members(text, r, fam):
|
| 430 |
for m in fam.members:
|
| 431 |
-
if m.text_hint and m.
|
| 432 |
return {m.lineage}
|
| 433 |
if (fam.family_text and fam.family_text.search(text)) or any(s.startswith("fulltext") for s in r["sources"]):
|
| 434 |
-
return {fam.default_member}
|
| 435 |
# The author publishes family models and the name carries the family keyword as a token.
|
| 436 |
if fam.name_hint and fam.name_hint.search(r["repo_id"].split("/")[1]) and r["author"] in AUTHORS.get(fam.key, ()):
|
| 437 |
-
return {fam.default_member}
|
| 438 |
return set()
|
| 439 |
|
| 440 |
|
|
@@ -454,7 +514,8 @@ def classify_all(raw_today, cache, fam):
|
|
| 454 |
COMMUNITY[fam.key] = {"by_sha": by_sha, "total": total,
|
| 455 |
"created": {k: str(v or "9999") for k, v in created.items()}}
|
| 456 |
# A derivative cannot predate its base repo; the default member never needs the check.
|
| 457 |
-
cutoff = {m.lineage: str(created
|
|
|
|
| 458 |
out, mlabels = [], {}
|
| 459 |
rows = raw_today.to_dict("records")
|
| 460 |
for r in rows:
|
|
@@ -476,6 +537,36 @@ def classify_all(raw_today, cache, fam):
|
|
| 476 |
return out
|
| 477 |
|
| 478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
def _nsfw_spread(mlabels, g, fam):
|
| 480 |
"""Adult flags beyond a repo's own name/tags/card. These only decide what the public page
|
| 481 |
names; every repo is still counted.
|
|
|
|
| 16 |
|
| 17 |
import numpy as np
|
| 18 |
|
| 19 |
+
from .enrich import is_weight
|
| 20 |
+
from .family import Arch
|
| 21 |
+
|
| 22 |
+
VERSION = "2026-11-20.1"
|
| 23 |
DERIVED = {"adapter", "finetune", "merge", "quantized", "repackage", "mirror", "component"}
|
| 24 |
HF_RELATIONS = {"adapter", "finetune", "merge", "quantized"}
|
| 25 |
SAME = 1e-3 # probe distance below this = same weights (bf16 -> fp16 copies land at ~0)
|
|
|
|
| 97 |
|
| 98 |
def sha_mirror(files, fam):
|
| 99 |
wb = [f for f in files or [] if f.get("sha256") and f.get("size", 0) > 1_000_000
|
| 100 |
+
and is_weight(f["name"])] # tokenizers etc. are shared widely
|
| 101 |
if not wb:
|
| 102 |
return None
|
| 103 |
total = sum(f["size"] for f in wb)
|
|
|
|
| 114 |
return lin, any_b / total
|
| 115 |
|
| 116 |
|
| 117 |
+
def architecture(ev, fam):
|
| 118 |
+
"""The family layout a repo ships, from config.json or the GGUF header: (Arch, why); ("other",
|
| 119 |
+
why) when the repo names another model's architecture; None when it names none."""
|
| 120 |
+
if not fam.archs:
|
| 121 |
+
return None
|
| 122 |
+
kv = (ev.get("gguf") or {}).get("kv") or {}
|
| 123 |
+
ga = kv.get("general.architecture")
|
| 124 |
+
names = " ".join(str(x) for c in (ev.get("config") or {}, ev.get("file_config") or {})
|
| 125 |
+
for x in [c.get("model_type"), *(c.get("architectures") or [])] if x)
|
| 126 |
+
names = " ".join(x for x in [names, ga] if x)
|
| 127 |
+
if not names:
|
| 128 |
+
return None
|
| 129 |
+
size = {"hidden": ev.get("hidden_size") or kv.get(f"{ga}.embedding_length"),
|
| 130 |
+
"vocab": ev.get("vocab_size") or kv.get(f"{ga}.vocab_size") or kv.get("tokenizer.ggml.tokens.count")}
|
| 131 |
+
near = None
|
| 132 |
+
for a in fam.archs:
|
| 133 |
+
if not a.names.search(names):
|
| 134 |
+
continue
|
| 135 |
+
want = [(k, v) for k, v in (("hidden", a.hidden), ("vocab", a.vocab)) if v]
|
| 136 |
+
if a.strict and any(not size[k] for k, _ in want):
|
| 137 |
+
continue
|
| 138 |
+
off = [f"{k} {size[k]},官方是 {v}" for k, v in want if size[k] and int(size[k]) != v]
|
| 139 |
+
if not off:
|
| 140 |
+
return a, f"模型结构是 {a.label}({names.split()[0]})"
|
| 141 |
+
near = near or f"结构名和 {a.label} 一样,但尺寸不对({';'.join(off)}),不是我们的权重"
|
| 142 |
+
return "other", near or f"模型结构是 {names.split()[0]},不是这个家族的"
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def _header_names(ev):
|
| 146 |
+
"""What a GGUF header says about where it came from (general.name, base_model ...)."""
|
| 147 |
+
kv = (ev.get("gguf") or {}).get("kv") or {}
|
| 148 |
+
return {k: v for k, v in kv.items() if k.startswith(("general.name", "general.basename", "general.base_model",
|
| 149 |
+
"general.finetune", "general.source"))}
|
| 150 |
+
|
| 151 |
+
|
| 152 |
def _res(lineage, relation, family, confidence, evidence, flags):
|
| 153 |
return dict(lineage=lineage, relation=relation, family=family, confidence=confidence,
|
| 154 |
evidence=evidence, flags=flags, copy_of=None)
|
|
|
|
| 203 |
readable = bool(keys.get("n")) or bool(ev.get("gguf"))
|
| 204 |
mi = json.dumps(ev.get("model_index") or {})
|
| 205 |
ctx = {"markers": markers, "sig": sig, "is_dit": is_dit, "is_lora": is_lora}
|
| 206 |
+
arch, arch_why = architecture(ev, fam) or (None, None)
|
| 207 |
+
own = isinstance(arch, Arch) # the family's own layout (config / GGUF header)
|
| 208 |
+
other_arch = arch == "other"
|
| 209 |
|
| 210 |
# ---- Tier 1: structural evidence --------------------------------------------------
|
| 211 |
mirror = sha_mirror(files, fam)
|
|
|
|
| 228 |
if sub in mi:
|
| 229 |
t1(lin, f"model_index.json 是 {lin} 的管线")
|
| 230 |
break
|
| 231 |
+
if own and len(arch.members) == 1:
|
| 232 |
+
t1(arch.members[0], arch_why, True)
|
| 233 |
+
elif own: # shared by several members: rules the others out
|
| 234 |
+
E.append(arch_why)
|
| 235 |
+
for lin in fam.lineages:
|
| 236 |
+
if lin not in arch.members:
|
| 237 |
+
score[lin] -= 20
|
| 238 |
created = str(r.get("created_at") or "")
|
| 239 |
if meta not in ("{}", ""):
|
| 240 |
for rx, lin, why in fam.meta_rules:
|
|
|
|
| 258 |
if decl:
|
| 259 |
score[decl] += 5
|
| 260 |
E.append(f"声明的 base_model 指向 {decl}")
|
| 261 |
+
header = json.dumps(_header_names(ev)).lower() if fam.header_rules else ""
|
| 262 |
+
for rx, lin, why in fam.header_rules:
|
| 263 |
+
m = rx.search(header)
|
| 264 |
+
if m and not (created and cutoff.get(lin) and created < cutoff[lin]):
|
| 265 |
+
score[lin] += 3
|
| 266 |
+
E.append(f"{why}({m.group(0)})")
|
| 267 |
+
break
|
| 268 |
video_member = next((m.lineage for m in fam.members if m.modality == "video"), None)
|
| 269 |
if video_member and ev.get("has_video_media") and not is_text_llm:
|
| 270 |
score[video_member] += 3
|
|
|
|
| 275 |
score[lin] += w
|
| 276 |
E.append(why)
|
| 277 |
member_hit = member_hit or lin != fam.default_member
|
| 278 |
+
if fam.default_member and fam.family_text and fam.family_text.search(readme) and not member_hit:
|
| 279 |
score[fam.default_member] += 2
|
| 280 |
pt = r.get("pipeline_tag") or ""
|
| 281 |
for m in fam.members:
|
|
|
|
| 295 |
for m in fam.members:
|
| 296 |
if m.text_hint and m.text_hint.search(name):
|
| 297 |
score[m.lineage] += 1.5
|
| 298 |
+
if fam.default_member and fam.family_text and fam.family_text.search(name):
|
| 299 |
score[fam.default_member] += 1
|
| 300 |
|
| 301 |
# ---- Family gate -------------------------------------------------------------------
|
| 302 |
fam_text = bool(fam.family_text and fam.family_text.search(text)) or any(
|
| 303 |
+
m.text_hint and m.text_hint.search(text) for m in fam.members if m.lineage != fam.text_member)
|
| 304 |
name_fam = bool(fam.family_text and fam.family_text.search(name)) or any(
|
| 305 |
m.text_hint and m.text_hint.search(name) for m in fam.members)
|
| 306 |
if other_dit and is_lora and not tier1 and not decl:
|
|
|
|
| 308 |
component_for_family = bool(fam_text and fam.component_names and fam.component_names.search(name))
|
| 309 |
if other_dit and not tier1 and not decl and not name_fam and not component_for_family:
|
| 310 |
return _res("unrelated", None, False, "high", ["是别的模型的权重(层的尺寸不对),名字也没提到这个家族"], flags)
|
| 311 |
+
if other_arch and not tier1 and not decl and not name_fam:
|
| 312 |
+
return _res("unrelated", None, False, "high", [arch_why + ",名字也没提到这个家族"], flags)
|
| 313 |
author_hint = bool(fam.name_hint and fam.name_hint.search(name) and r["author"] in AUTHORS.get(fam.key, ()))
|
| 314 |
+
if not (decl or tier1 or is_dit or own or fam_text or author_hint):
|
| 315 |
return _res("unrelated", None, False, "medium", ["没有任何相关信号"], flags)
|
| 316 |
+
if author_hint and not (decl or tier1 or is_dit or own or fam_text):
|
| 317 |
E.append("作者发布过这个家族的衍生模型,名字里也有家族关键词")
|
| 318 |
+
if fam.default_member:
|
| 319 |
+
score[fam.default_member] += 1
|
| 320 |
|
| 321 |
# ---- Decide lineage ----------------------------------------------------------------
|
| 322 |
+
shaped = (list(arch.members) if own else
|
| 323 |
+
[m.lineage for m in fam.members if m.modality != "text"] if is_dit else [])
|
| 324 |
+
possible = [lin for lin in shaped if score[lin] > -10]
|
| 325 |
if tier1:
|
| 326 |
if len(tier1) == 1:
|
| 327 |
lineage, conf = next(iter(tier1)), "high"
|
|
|
|
| 334 |
else:
|
| 335 |
lineage, conf = "unknown", "low"
|
| 336 |
E.append("结构证据互相矛盾:" + " / ".join(tier1))
|
| 337 |
+
elif shaped and len(possible) == 1:
|
| 338 |
lineage, conf = possible[0], "medium"
|
| 339 |
+
E.append(f"结构是这个家族的 {'DiT' if not own else arch.label},且创建时只有 {possible[0]} 已发布")
|
| 340 |
else:
|
| 341 |
+
ranked = sorted(score.items(), key=lambda x: -x[1]) + [(None, 0.0)] # a one-member family
|
| 342 |
(l1, s1), (_, s2) = ranked[0], ranked[1]
|
| 343 |
if s1 >= 4 and s1 - s2 >= 3:
|
| 344 |
lineage, conf = l1, "medium"
|
|
|
|
| 353 |
if copy_of:
|
| 354 |
flags.append("copy")
|
| 355 |
E.append(f"整仓权重与更早的 {copy_of} 逐字节相同,是重新上传")
|
| 356 |
+
outside_llm = is_text_llm and not own and (other_arch or not fam.own_llm)
|
| 357 |
+
family_weights = is_dit or own or bool(weight_ev) or (is_text_llm and fam.own_llm and not other_arch)
|
| 358 |
+
rel = relation(r, ev, is_lora, family_weights, outside_llm, mirror, pm, name,
|
| 359 |
+
E, pe_like, fam, readable, other_dit or other_arch, lineage)
|
| 360 |
if rel == "tool" and not (decl or name_fam or component_for_family):
|
| 361 |
# Weights from another model and only the card mentions the family: an ad, a comparison,
|
| 362 |
# or training data made with it. Not part of the ecosystem count.
|
| 363 |
return _res("unrelated", None, False, "medium", ["权重来自别的模型,只在模型卡里提到这个家族"], flags)
|
| 364 |
if rel == "tool":
|
| 365 |
+
E.append("权重来自别的模型,是用这个家族的输出蒸馏出来的" if other_arch and DISTILL_NAME.search(name)
|
| 366 |
+
else "权重不是来自这个家族,是给它用的周边工具")
|
| 367 |
if DISTILL_NAME.search(name) and rel in ("finetune", "adapter", "merge", "quantized"):
|
| 368 |
flags.append("distilled")
|
| 369 |
out = _res(lineage, rel, True, conf, E, flags)
|
|
|
|
| 376 |
wbytes = ev.get("weight_bytes", 0)
|
| 377 |
card = ev.get("card") or {}
|
| 378 |
main = ev.get("main_weight") or ""
|
| 379 |
+
if (ev.get("n_weight_files", 0) == 0 or wbytes < 1_000_000) and re.search(r"exl[23]", name, re.I):
|
| 380 |
+
E.append("EXL2/EXL3 仓库把每档量化放在各自的分支里,主分支只有说明")
|
| 381 |
+
return "quantized"
|
| 382 |
if ev.get("n_weight_files", 0) == 0 or wbytes < 1_000_000:
|
| 383 |
return "no-weights"
|
| 384 |
if mirror and mirror[1] >= 0.9:
|
| 385 |
return "mirror"
|
| 386 |
if is_text_llm and not pe_like:
|
| 387 |
if fam.text_component and fam.text_component.search(name + " " + json.dumps(ev.get("config"))):
|
| 388 |
+
E.append(fam.text_component_why)
|
| 389 |
return "component"
|
| 390 |
return "tool"
|
| 391 |
if not is_family_weights and not pe_like:
|
|
|
|
| 427 |
return "finetune"
|
| 428 |
|
| 429 |
|
|
|
|
|
|
|
| 430 |
|
| 431 |
|
| 432 |
def _weights(ev):
|
| 433 |
return {f["sha256"]: f["size"] for f in (ev or {}).get("files", [])
|
| 434 |
+
if f.get("sha256") and f.get("size", 0) > 1_000_000 and is_weight(f["name"])}
|
| 435 |
|
| 436 |
|
| 437 |
def community_mirror(r, ev, fam):
|
|
|
|
| 488 |
|
| 489 |
def _text_members(text, r, fam):
|
| 490 |
for m in fam.members:
|
| 491 |
+
if m.text_hint and m.lineage != fam.text_member and m.text_hint.search(text):
|
| 492 |
return {m.lineage}
|
| 493 |
if (fam.family_text and fam.family_text.search(text)) or any(s.startswith("fulltext") for s in r["sources"]):
|
| 494 |
+
return {fam.default_member or "unknown"}
|
| 495 |
# The author publishes family models and the name carries the family keyword as a token.
|
| 496 |
if fam.name_hint and fam.name_hint.search(r["repo_id"].split("/")[1]) and r["author"] in AUTHORS.get(fam.key, ()):
|
| 497 |
+
return {fam.default_member or "unknown"}
|
| 498 |
return set()
|
| 499 |
|
| 500 |
|
|
|
|
| 514 |
COMMUNITY[fam.key] = {"by_sha": by_sha, "total": total,
|
| 515 |
"created": {k: str(v or "9999") for k, v in created.items()}}
|
| 516 |
# A derivative cannot predate its base repo; the default member never needs the check.
|
| 517 |
+
cutoff = {m.lineage: min((str(created[x]) for x in m.repos if created.get(x)), default="")
|
| 518 |
+
for m in fam.members if m.lineage != fam.default_member}
|
| 519 |
out, mlabels = [], {}
|
| 520 |
rows = raw_today.to_dict("records")
|
| 521 |
for r in rows:
|
|
|
|
| 537 |
return out
|
| 538 |
|
| 539 |
|
| 540 |
+
CONFIDENCE = {"high": 3, "medium": 2, "low": 1}
|
| 541 |
+
|
| 542 |
+
|
| 543 |
+
def resolve_overlaps(by_family, others=None):
|
| 544 |
+
"""One repo counts in one family. Where several families claim the same repo as a derived
|
| 545 |
+
model, the strongest claim keeps it (confidence, then family order: h3, m, music); in the
|
| 546 |
+
other families it gets the flag "other_family" and family=False, so it is not counted twice.
|
| 547 |
+
`others`: labels of families not run today, which take part but are not changed.
|
| 548 |
+
Returns {repo: family that keeps it} for the repos that moved."""
|
| 549 |
+
order = list(by_family) + [k for k in (others or {}) if k not in by_family]
|
| 550 |
+
from . import families as registry
|
| 551 |
+
order.sort(key=lambda k: list(registry.FAMILIES).index(k) if k in registry.FAMILIES else 99)
|
| 552 |
+
claims = {}
|
| 553 |
+
for key in order:
|
| 554 |
+
for x in by_family.get(key) or (others or {}).get(key) or []:
|
| 555 |
+
if x["kind"] == "model" and x["family"] and x["relation"] in DERIVED:
|
| 556 |
+
claims.setdefault(x["repo_id"], []).append((-CONFIDENCE.get(x["confidence"], 0), order.index(key), key))
|
| 557 |
+
moved = {}
|
| 558 |
+
for key, labs in by_family.items():
|
| 559 |
+
for x in labs:
|
| 560 |
+
c = claims.get(x["repo_id"], [])
|
| 561 |
+
if len(c) > 1 and min(c)[2] != key:
|
| 562 |
+
keeper = min(c)[2]
|
| 563 |
+
x["family"] = False
|
| 564 |
+
x["flags"] = x["flags"] + ["other_family"]
|
| 565 |
+
x["evidence"] = x["evidence"] + [f"另一个系列({keeper})的证据更强,算在那边"]
|
| 566 |
+
moved[x["repo_id"]] = keeper
|
| 567 |
+
return moved
|
| 568 |
+
|
| 569 |
+
|
| 570 |
def _nsfw_spread(mlabels, g, fam):
|
| 571 |
"""Adult flags beyond a repo's own name/tags/card. These only decide what the public page
|
| 572 |
names; every repo is still counted.
|
code/hfeco/enrich.py
CHANGED
|
@@ -14,6 +14,11 @@ 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", ".tflite",
|
| 18 |
".mlmodel", ".engine", ".pte")
|
| 19 |
MEDIA_VIDEO = (".mp4", ".webm", ".mov", ".gif", ".mkv")
|
|
@@ -93,6 +98,8 @@ def gguf_header(repo, fname, limit=8_000_000):
|
|
| 93 |
for _ in range(nkv):
|
| 94 |
k, p = rstr(p)
|
| 95 |
t, = struct.unpack_from("<I", buf, p); p += 4
|
|
|
|
|
|
|
| 96 |
v, p = rval(t, p)
|
| 97 |
if isinstance(v, (str, int, float, bool)) and len(str(v)) < 300:
|
| 98 |
out["kv"][k] = v
|
|
@@ -107,9 +114,10 @@ def gguf_header(repo, fname, limit=8_000_000):
|
|
| 107 |
return out
|
| 108 |
|
| 109 |
|
| 110 |
-
def _pick_weight(files):
|
| 111 |
-
"""Main weight file: prefer DiT / LoRA files over VAE, text encoder, embeddings
|
| 112 |
-
|
|
|
|
| 113 |
if not w:
|
| 114 |
return None
|
| 115 |
|
|
@@ -118,10 +126,24 @@ def _pick_weight(files):
|
|
| 118 |
s = f["size"] or 0
|
| 119 |
bad = any(x in n for x in ("vae", "text_encoder", "text_encoders/", "tokenizer", "embeddings/",
|
| 120 |
"clip", "t5", "qwen", "encoder", "tae", "upscal"))
|
| 121 |
-
|
|
|
|
| 122 |
return max(w, key=score)
|
| 123 |
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
def enrich_model(repo_id, fam):
|
| 126 |
i = hub.info("model", repo_id, files_metadata=True)
|
| 127 |
files = [{"name": s.rfilename, "size": s.size or 0,
|
|
@@ -130,12 +152,12 @@ def enrich_model(repo_id, fam):
|
|
| 130 |
"card": (i.card_data.to_dict() if i.card_data else {}), "errors": []}
|
| 131 |
names = [f["name"] for f in files]
|
| 132 |
lower = [n.lower() for n in names]
|
| 133 |
-
ev["n_weight_files"] = sum(
|
| 134 |
-
ev["weight_bytes"] = sum(f["size"] for f in files if f["name"]
|
| 135 |
ev["has_video_media"] = any(n.endswith(MEDIA_VIDEO) for n in lower)
|
| 136 |
ev["has_image_media"] = any(n.endswith(MEDIA_IMAGE) for n in lower)
|
| 137 |
ev["has_adapter_config"] = any(n.endswith("adapter_config.json") for n in lower)
|
| 138 |
-
ev["has_gguf"] = any(
|
| 139 |
|
| 140 |
for small in [n for n in names if n.endswith("model_index.json")][:1]:
|
| 141 |
try:
|
|
@@ -148,11 +170,27 @@ def enrich_model(repo_id, fam):
|
|
| 148 |
except Exception as e:
|
| 149 |
ev["errors"].append(f"readme: {e}")
|
| 150 |
|
| 151 |
-
main = _pick_weight(files)
|
| 152 |
ev["main_weight"] = main["name"] if main else None
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
try:
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
| 156 |
if g:
|
| 157 |
ev["gguf"] = {"kv": g["kv"], "n_tensors": g["n_tensors"],
|
| 158 |
"tensor_names": _summarise_keys(g["tensors"]), "truncated": g.get("truncated")}
|
|
@@ -161,7 +199,7 @@ def enrich_model(repo_id, fam):
|
|
| 161 |
ev["errors"].append(f"gguf: {e}")
|
| 162 |
elif main and main["name"].lower().endswith((".safetensors", ".sft")):
|
| 163 |
ev.update(_safetensors_evidence(repo_id, main["name"], files, fam))
|
| 164 |
-
if not ev.get("st_meta") or len(json.dumps(ev["st_meta"])) < 40:
|
| 165 |
ev["st_meta"] = {**_other_meta(repo_id, files, main["name"]), **(ev.get("st_meta") or {})}
|
| 166 |
return ev
|
| 167 |
|
|
@@ -194,8 +232,8 @@ def _safetensors_evidence(repo_id, fname, files, fam):
|
|
| 194 |
# Sharded checkpoints: the index lists every tensor name.
|
| 195 |
def folder(p):
|
| 196 |
return p.rsplit("/", 1)[0] if "/" in p else ""
|
| 197 |
-
idx = [f["name"] for f in files
|
| 198 |
-
|
| 199 |
all_keys = keys
|
| 200 |
if idx:
|
| 201 |
try:
|
|
|
|
| 14 |
|
| 15 |
from . import hub
|
| 16 |
|
| 17 |
+
def is_weight(name):
|
| 18 |
+
"""A weight file, also one split into byte parts for the upload limit (x.gguf.part1of3)."""
|
| 19 |
+
return re.sub(r"\.part\d+of\d+$", "", name.lower()).endswith(WEIGHT_EXT)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
WEIGHT_EXT = (".safetensors", ".gguf", ".bin", ".pt", ".pth", ".ckpt", ".onnx", ".npz", ".sft", ".tflite",
|
| 23 |
".mlmodel", ".engine", ".pte")
|
| 24 |
MEDIA_VIDEO = (".mp4", ".webm", ".mov", ".gif", ".mkv")
|
|
|
|
| 98 |
for _ in range(nkv):
|
| 99 |
k, p = rstr(p)
|
| 100 |
t, = struct.unpack_from("<I", buf, p); p += 4
|
| 101 |
+
if t == 9: # arrays: keep their length (tokenizer.ggml.tokens = vocabulary size)
|
| 102 |
+
out["kv"][k + ".count"] = struct.unpack_from("<Q", buf, p + 4)[0]
|
| 103 |
v, p = rval(t, p)
|
| 104 |
if isinstance(v, (str, int, float, bool)) and len(str(v)) < 300:
|
| 105 |
out["kv"][k] = v
|
|
|
|
| 114 |
return out
|
| 115 |
|
| 116 |
|
| 117 |
+
def _pick_weight(files, fam=None):
|
| 118 |
+
"""Main weight file: prefer DiT / LoRA files over VAE, text encoder, embeddings, and a file
|
| 119 |
+
named after the family over extras bundled next to it."""
|
| 120 |
+
w = [f for f in files if is_weight(f["name"])]
|
| 121 |
if not w:
|
| 122 |
return None
|
| 123 |
|
|
|
|
| 126 |
s = f["size"] or 0
|
| 127 |
bad = any(x in n for x in ("vae", "text_encoder", "text_encoders/", "tokenizer", "embeddings/",
|
| 128 |
"clip", "t5", "qwen", "encoder", "tae", "upscal"))
|
| 129 |
+
named = bool(fam and fam.archs and fam.family_text and fam.family_text.search(n))
|
| 130 |
+
return (0 if bad else 1, named, s)
|
| 131 |
return max(w, key=score)
|
| 132 |
|
| 133 |
|
| 134 |
+
def _first_shard(name, names):
|
| 135 |
+
"""A split GGUF keeps its metadata in part 1 only (...-00001-of-00004.gguf, ....gguf.part1of3)."""
|
| 136 |
+
m = re.search(r"-(\d{5})-of-(\d{5})\.gguf$", name)
|
| 137 |
+
if m and m.group(1) != "00001":
|
| 138 |
+
first = name[:m.start()] + f"-00001-of-{m.group(2)}.gguf"
|
| 139 |
+
return first if first in names else name
|
| 140 |
+
m = re.search(r"\.part(\d+)of(\d+)$", name)
|
| 141 |
+
if m and m.group(1) != "1":
|
| 142 |
+
first = name[:m.start()] + f".part1of{m.group(2)}"
|
| 143 |
+
return first if first in names else name
|
| 144 |
+
return name
|
| 145 |
+
|
| 146 |
+
|
| 147 |
def enrich_model(repo_id, fam):
|
| 148 |
i = hub.info("model", repo_id, files_metadata=True)
|
| 149 |
files = [{"name": s.rfilename, "size": s.size or 0,
|
|
|
|
| 152 |
"card": (i.card_data.to_dict() if i.card_data else {}), "errors": []}
|
| 153 |
names = [f["name"] for f in files]
|
| 154 |
lower = [n.lower() for n in names]
|
| 155 |
+
ev["n_weight_files"] = sum(is_weight(n) for n in lower)
|
| 156 |
+
ev["weight_bytes"] = sum(f["size"] for f in files if is_weight(f["name"]))
|
| 157 |
ev["has_video_media"] = any(n.endswith(MEDIA_VIDEO) for n in lower)
|
| 158 |
ev["has_image_media"] = any(n.endswith(MEDIA_IMAGE) for n in lower)
|
| 159 |
ev["has_adapter_config"] = any(n.endswith("adapter_config.json") for n in lower)
|
| 160 |
+
ev["has_gguf"] = any(".gguf" in n and is_weight(n) for n in lower)
|
| 161 |
|
| 162 |
for small in [n for n in names if n.endswith("model_index.json")][:1]:
|
| 163 |
try:
|
|
|
|
| 170 |
except Exception as e:
|
| 171 |
ev["errors"].append(f"readme: {e}")
|
| 172 |
|
| 173 |
+
main = _pick_weight(files, fam)
|
| 174 |
ev["main_weight"] = main["name"] if main else None
|
| 175 |
+
# The config that describes the weights: the repo's own, else the one next to the main weight
|
| 176 |
+
# (language_model/config.json in a pipeline repo). The API's config omits sizes.
|
| 177 |
+
folder = main["name"].rsplit("/", 1)[0] + "/" if main and "/" in main["name"] else ""
|
| 178 |
+
cfg_name = folder + "config.json" if folder + "config.json" in names else "config.json"
|
| 179 |
+
if cfg_name in names:
|
| 180 |
+
try:
|
| 181 |
+
c = json.loads(_range(repo_id, cfg_name, 0, 300_000))
|
| 182 |
+
t = c.get("text_config") or {}
|
| 183 |
+
ev["hidden_size"] = c.get("hidden_size") or t.get("hidden_size")
|
| 184 |
+
ev["vocab_size"] = c.get("vocab_size") or t.get("vocab_size")
|
| 185 |
+
ev["file_config"] = {"model_type": c.get("model_type"), "architectures": c.get("architectures")}
|
| 186 |
+
except Exception as e:
|
| 187 |
+
ev["errors"].append(f"config: {e}")
|
| 188 |
+
if main and re.search(r"\.gguf(\.part\d+of\d+)?$", main["name"].lower()):
|
| 189 |
try:
|
| 190 |
+
# Families told apart by architecture need only the metadata at the start of the file;
|
| 191 |
+
# tensor shapes (DiT signatures, markers) sit after the tokenizer, megabytes in.
|
| 192 |
+
g = gguf_header(repo_id, _first_shard(main["name"], names),
|
| 193 |
+
limit=512_000 if fam.archs and not fam.marker_rules else 8_000_000)
|
| 194 |
if g:
|
| 195 |
ev["gguf"] = {"kv": g["kv"], "n_tensors": g["n_tensors"],
|
| 196 |
"tensor_names": _summarise_keys(g["tensors"]), "truncated": g.get("truncated")}
|
|
|
|
| 199 |
ev["errors"].append(f"gguf: {e}")
|
| 200 |
elif main and main["name"].lower().endswith((".safetensors", ".sft")):
|
| 201 |
ev.update(_safetensors_evidence(repo_id, main["name"], files, fam))
|
| 202 |
+
if fam.meta_rules and (not ev.get("st_meta") or len(json.dumps(ev["st_meta"])) < 40):
|
| 203 |
ev["st_meta"] = {**_other_meta(repo_id, files, main["name"]), **(ev.get("st_meta") or {})}
|
| 204 |
return ev
|
| 205 |
|
|
|
|
| 232 |
# Sharded checkpoints: the index lists every tensor name.
|
| 233 |
def folder(p):
|
| 234 |
return p.rsplit("/", 1)[0] if "/" in p else ""
|
| 235 |
+
idx = [f["name"] for f in files if fam.marker_rules # every tensor name, for the marker rules
|
| 236 |
+
and f["name"].endswith(".safetensors.index.json") and folder(f["name"]) == folder(fname)]
|
| 237 |
all_keys = keys
|
| 238 |
if idx:
|
| 239 |
try:
|
code/hfeco/families/__init__.py
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def get(key):
|
|
|
|
| 1 |
+
"""One file per model series, all filling in the same Family fields (see hfeco/family.py):
|
| 2 |
|
| 3 |
+
h3.py video and image: MiniMax-H3, H3-Image (and H3-Image-PE, classified but not shown)
|
| 4 |
+
m.py language: Text-01, VL-01, M1, M2 ... M2.7, M3, M3.1-Flash
|
| 5 |
+
music.py music: Music3
|
| 6 |
+
|
| 7 |
+
Releases without a file here (SynLogic, VTP) are followed through declared base_model only.
|
| 8 |
+
"""
|
| 9 |
+
from . import h3, m, music
|
| 10 |
+
|
| 11 |
+
FAMILIES = {f.key: f for f in [h3.FAMILY, m.FAMILY, music.FAMILY]}
|
| 12 |
|
| 13 |
|
| 14 |
def get(key):
|
code/hfeco/families/m.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""MiniMax language models: Text-01, VL-01, M1, M2, M2.1, M2.5, M2.7, M3, M3.1-Flash.
|
| 2 |
+
|
| 3 |
+
Facts these rules rely on (checked 2026-11-20 against the official config.json files):
|
| 4 |
+
- Four layouts. Text-01 and M1 share one (model_type minimax_text_01 / minimax_m1, both
|
| 5 |
+
`minimax` in the transformers port; hidden 6144, 80 layers, 32 experts); VL-01 wraps it
|
| 6 |
+
(minimax_vl_01). M2, M2.1, M2.5 and M2.7 share minimax_m2 (hidden 3072, 62 layers, 256
|
| 7 |
+
experts). M3 and M3.1-Flash share minimax_m3_vl (hidden 6144, 60 layers, 128 experts).
|
| 8 |
+
GGUF headers call them minimax-m2 / minimax-m3.
|
| 9 |
+
- So the layout says which line a repo is built on, not which release: within a line it is
|
| 10 |
+
the declared base_model, the GGUF header (general.name / base_model), the repo name, the
|
| 11 |
+
card and the creation date (a repo cannot be built on a release that came out after it).
|
| 12 |
+
- Pruning experts (REAP) keeps the hidden size, so it stays a derivative; toy test models
|
| 13 |
+
reuse the architecture at a different hidden size and are left out, as are models
|
| 14 |
+
distilled from our outputs into another architecture (their config names that one).
|
| 15 |
+
- The Hub tags every repo with its model_type, so the architecture tags find derivatives
|
| 16 |
+
whatever they are called.
|
| 17 |
+
"""
|
| 18 |
+
import re
|
| 19 |
+
|
| 20 |
+
from ..family import Arch, Family, Member
|
| 21 |
+
|
| 22 |
+
ORG = "MiniMaxAI/"
|
| 23 |
+
END = r"(?![._]?\d)" # "M2" is not "M2.5" or "M25"
|
| 24 |
+
|
| 25 |
+
# lineage, official repos, how the release is written in names (after "MiniMax" in cards)
|
| 26 |
+
RELEASES = [
|
| 27 |
+
("Text-01", ["MiniMax-Text-01", "MiniMax-Text-01-hf"], r"text[-_ ]?0?1|0?1[-_ ]?text"),
|
| 28 |
+
("VL-01", ["MiniMax-VL-01"], r"vl[-_ ]?0?1"),
|
| 29 |
+
("M1", ["MiniMax-M1-80k", "MiniMax-M1-40k", "MiniMax-M1-80k-hf", "MiniMax-M1-40k-hf"], r"m1"),
|
| 30 |
+
("M2", ["MiniMax-M2"], r"m2(?!-[157](?!\d))"), # "M2-5" is M2.5
|
| 31 |
+
("M2.1", ["MiniMax-M2.1"], r"m2[-._]1"),
|
| 32 |
+
("M2.5", ["MiniMax-M2.5"], r"m2[-._]5"),
|
| 33 |
+
("M2.7", ["MiniMax-M2.7"], r"m2[-._]7"),
|
| 34 |
+
("M3", ["MiniMax-M3", "MiniMax-M3-MXFP8"], r"m3(?![-_ ]?flash|-1(?!\d))"),
|
| 35 |
+
("M3.1-Flash", ["MiniMax-M3.1-Flash"], r"m3(?:[-._]1)?[-_ ]?flash|m3[-._]1"),
|
| 36 |
+
]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def in_name(tok):
|
| 40 |
+
"""The release on its own in a repo name, also glued to the family ("MiniMaxM2")."""
|
| 41 |
+
return re.compile(rf"(?:(?<![a-z0-9])|(?<=minimax))(?:{tok}){END}", re.I)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def in_text(tok):
|
| 45 |
+
"""The release in prose or a GGUF header: only with "MiniMax" in front ("runs on an M3 Max")."""
|
| 46 |
+
return re.compile(rf"minimax[-_ ]?(?:{tok}){END}", re.I)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
ADD_ON = re.compile(r"eagle|specul|aurora[-_ ]?spec|dspark|dflash|draft|\bmtp\b|mmproj|vision|control[-_ ]?vectors?", re.I)
|
| 50 |
+
FAMILY_TEXT = re.compile(r"minimax[-_ ]?(?:m[123]|text[-_ ]?0?1|0?1[-_ ]?text|vl[-_ ]?0?1)", re.I)
|
| 51 |
+
|
| 52 |
+
FAMILY = Family(
|
| 53 |
+
key="m",
|
| 54 |
+
title="MiniMax 语言模型",
|
| 55 |
+
members=[Member(lin, ORG + repos[0], "text", in_name(tok), also=tuple(ORG + r for r in repos[1:]))
|
| 56 |
+
for lin, repos, tok in RELEASES],
|
| 57 |
+
default_member=None, # "MiniMax" alone does not say which release
|
| 58 |
+
name_queries=["minimax"],
|
| 59 |
+
fulltext_queries=[], # benchmark tables everywhere mention M2 / M3; tags and names suffice
|
| 60 |
+
tag_filters=["minimax_m2", "minimax_m3_vl", "minimax_m1", "minimax_text_01", "minimax_vl_01"],
|
| 61 |
+
family_text=FAMILY_TEXT,
|
| 62 |
+
name_hint=FAMILY_TEXT,
|
| 63 |
+
own_llm=True,
|
| 64 |
+
archs=[
|
| 65 |
+
Arch(("M2", "M2.1", "M2.5", "M2.7"), re.compile(r"minimax[-_]?m2", re.I), 3072),
|
| 66 |
+
Arch(("M3", "M3.1-Flash"), re.compile(r"minimax[-_]?m3", re.I), 6144),
|
| 67 |
+
Arch(("VL-01",), re.compile(r"minimax[-_]?vl[-_]?0?1", re.I), 6144),
|
| 68 |
+
Arch(("M1",), re.compile(r"minimax[-_]?m1", re.I), 6144),
|
| 69 |
+
Arch(("Text-01",), re.compile(r"minimax[-_]?(?:text[-_]?)?0?1", re.I), 6144),
|
| 70 |
+
# the transformers port calls both "minimax"
|
| 71 |
+
Arch(("Text-01", "M1"), re.compile(r"\bminimax\b(?![-_])|MiniMaxForCausalLM", re.I), 6144),
|
| 72 |
+
],
|
| 73 |
+
# parts made for a release rather than from its weights: draft models for speculative decoding,
|
| 74 |
+
# the vision tower and its GGUF projector, control vectors
|
| 75 |
+
text_component=ADD_ON,
|
| 76 |
+
text_component_why="是给它配套的草稿模型(投机解码)",
|
| 77 |
+
component_names=ADD_ON,
|
| 78 |
+
card_rules=[(in_text(tok), lin, 1, f"模型卡提到 MiniMax-{lin}", False) for lin, _, tok in RELEASES],
|
| 79 |
+
header_rules=[(in_text(tok), lin, f"GGUF 文件头写明转自 MiniMax-{lin}") for lin, _, tok in RELEASES],
|
| 80 |
+
)
|
code/hfeco/families/m_reference.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code/hfeco/families/music.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""MiniMax music models: Music3.
|
| 2 |
+
|
| 3 |
+
Facts these rules rely on (checked 2026-11-20 against the official repo):
|
| 4 |
+
- Music3 is a pipeline, and the community ships its parts separately:
|
| 5 |
+
the pipeline as a whole: config.json model_type minimax_music3;
|
| 6 |
+
the DiT (36 layers, width 2048, feed-forward 16384): GGUF general.architecture minimax_music3,
|
| 7 |
+
or ComfyUI / diffusers safetensors (diffusion_transformer.transformer.layers.N / transformer_blocks.N);
|
| 8 |
+
the language model: a Qwen3 (hidden 4096) with its own 200,000-token vocabulary, where a
|
| 9 |
+
stock Qwen3-8B has 151,936. That vocabulary is what tells its MLX / safetensors copies
|
| 10 |
+
apart from ordinary Qwen3 models; its GGUFs name their own architecture (mm3-lm ...).
|
| 11 |
+
- Many repos are whole-repo re-uploads under the same name (someone/MiniMax-Music3) with no
|
| 12 |
+
base_model; the file hashes against the official repo catch those.
|
| 13 |
+
"""
|
| 14 |
+
import re
|
| 15 |
+
|
| 16 |
+
from ..family import Arch, Family, Member
|
| 17 |
+
|
| 18 |
+
MUSIC3 = re.compile(r"(?:(?<![a-z0-9])|(?<=minimax))music[-_ ]?3(?![._]?\d)", re.I)
|
| 19 |
+
FAMILY_TEXT = re.compile(r"minimax[-_ ]?music", re.I)
|
| 20 |
+
|
| 21 |
+
FAMILY = Family(
|
| 22 |
+
key="music",
|
| 23 |
+
title="MiniMax 音乐模型",
|
| 24 |
+
members=[Member("Music3", "MiniMaxAI/MiniMax-Music3", "audio", MUSIC3)],
|
| 25 |
+
default_member="Music3",
|
| 26 |
+
name_queries=["music3", "minimax-music"],
|
| 27 |
+
fulltext_queries=['"MiniMax-Music3"'],
|
| 28 |
+
tag_filters=["minimax_music3"],
|
| 29 |
+
family_text=FAMILY_TEXT,
|
| 30 |
+
name_hint=re.compile(r"minimax[-_ ]?music|music[-_ ]?3", re.I),
|
| 31 |
+
archs=[Arch(("Music3",), re.compile(r"minimax[-_]?music|abab|\bmm3[-_]", re.I)),
|
| 32 |
+
Arch(("Music3",), re.compile(r"qwen3", re.I), hidden=4096, vocab=200000, strict=True)],
|
| 33 |
+
own_llm=True,
|
| 34 |
+
sig_dims={16384},
|
| 35 |
+
sig_names=re.compile(r"(^|[._])(diffusion_transformer\.transformer\.layers|transformer_blocks)[._]\d+[._](ff|attn)"),
|
| 36 |
+
component_names=re.compile(r"(^|[^a-z])(vae|dav|vocoder|text[-_ ]?encoders?|tokenizer|latent[-_ ]refiner)([^a-z]|$)",
|
| 37 |
+
re.I),
|
| 38 |
+
card_rules=[(FAMILY_TEXT, "Music3", 2, "模型卡提到 MiniMax-Music", False)],
|
| 39 |
+
)
|
code/hfeco/families/music_reference.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"sha256": {"0d7c582e9c53eb1a83333906964294b6053e81c342cd62167da1514f375ea6d9": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/assets/minimax_ttm.wav", "size": 36460944}, "83179c5eaa9a68a370affe0c1b96c2179f659ea4175666b31071490a202c2a4d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/condition_encoder/diffusion_pytorch_model.safetensors", "size": 100671852}, "52adde6c6c52cca872f549449cd7b608677d1e69f4a98eee22da3403e63b56e8": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/dav.pth", "size": 491817450}, "a69b6f939699896193d417371fa0bb3748971c5aed9ab3118c3f75b5ac8ceac5": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/figures/music3.0-Architecture-Diagram.png", "size": 1097623}, "941f3ed9591684679e733d184308be89949abeb1b069a6e17e69a013ecec08fe": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/flowmatching_vae.pth", "size": 9828468476}, "1e95924a158b45b67cfad04fa0f0a352e5a263e69338734d7c1d558be776cc98": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/language_model/model-00001-of-00004.safetensors", "size": 4910103856}, "fde2d335eef7eafa268d35e53d4b040ee51d2f3fa727f9855b4c97d88a2892da": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/language_model/model-00002-of-00004.safetensors", "size": 4915960352}, "6549a831637ab678a573047e7fa8fdf966998c4f45330e6eb7573d67f7b9b4c6": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/language_model/model-00003-of-00004.safetensors", "size": 4983068496}, "a1c9865f357b64d3ae9f428fb98a844831e5a0aee9ed17b19bd7f7be32b964a9": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/language_model/model-00004-of-00004.safetensors", "size": 2359864688}, "bc63169ebf49c476995ced3f3dbae68f93ed9cf2a2997d3658863672f2f05f0f": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen3-8B-tokenizer-music/tokenizer.json", "size": 11423806}, "725ce815b308b4a27e3aa3e6f119df7941fb51e254bfd67554c4a4f7f9180a8d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00000-of-00048.safetensors", "size": 1638400144}, "ef64b4f6d8dd60c7288d1caebef63c1336511c0f70b93d7e26445135fed218e4": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00001-of-00048.safetensors", "size": 58720400}, "3e4df154f642995c40ef2916450751b55607d6ee956f6c16a283aab0e15cc632": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00002-of-00048.safetensors", "size": 285230720}, "3d9cf1da3c2096a76c83c28382d213fdf971f9935ce918dd4fa5e8eca2b8b0b6": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00003-of-00048.safetensors", "size": 385894144}, "118fab650caf1fabea9a02ebe7d1470aee432d864f92dbaae1c7c4f79406104f": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00004-of-00048.safetensors", "size": 385894144}, "7a3dcfc8d85c6a9c32c416a251eab634f94a68b938a4ded2bdbe253f20c59149": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00005-of-00048.safetensors", "size": 385894144}, "d3790d5fd2b792d72919660fe5f1f67bdb1dcfa9f0fe4994546f78ee56c9b669": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00006-of-00048.safetensors", "size": 385894144}, "7fddc6782c77cbc72da2ad59de44481f4a522209d0c93049ccb45e5ba8d0903a": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00007-of-00048.safetensors", "size": 385894144}, "3593e1c065a7c9e98549c988e0b93e66372d5ebee83a5087e8dd4ab6b1521fc4": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00008-of-00048.safetensors", "size": 385894144}, "9d7e532ae3d5de8a1b7ec9b18e0d16c6c3142d52100dfecec1fe23812cf0fdf7": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00009-of-00048.safetensors", "size": 385894144}, "ff035d2881fc2aade282c11cb083ebf975da136a8e9f8cc208c7053298c77ee1": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00010-of-00048.safetensors", "size": 385894144}, "81639eef3aa9e633a11aaa5735e7d8bc6254e6494f1a413f18dc27965eb75141": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00011-of-00048.safetensors", "size": 385894144}, "498d5b76cfac24f2465b437540d39a0f8e9d822d3ad1bcec2e7c991df51652b0": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00012-of-00048.safetensors", "size": 385894144}, "be29431b2e33aef359a1a0fa3867b9386631cde646a34c1fc86538a209a6ca71": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00013-of-00048.safetensors", "size": 385894152}, "c9b5ca8b4ca1f34df20d48c23f7f01f80751a15a10308703c3eed2693b86ca4e": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00014-of-00048.safetensors", "size": 385894152}, "337a491f37a967603bd622b1daaca312c759637c6c38415e31743b2f9a05c27c": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00015-of-00048.safetensors", "size": 385894152}, "71687a19e4f5376243da4c42dba4a3fffbad27d0414bae63e802e96a700b73dd": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00016-of-00048.safetensors", "size": 385894152}, "c44b315361a14d8ca417934d7d09cf40737459717b2ebf7e5f755b4affec8f34": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00017-of-00048.safetensors", "size": 385894152}, "5dcfe06cdc37d5456e330b9354be8b88ea1cf4146c456abc8fe08ade8b6a10e6": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00018-of-00048.safetensors", "size": 385894152}, "1132f82d97f2d4afef680b2eca823d3d6b3d75b985579e221aad94afc4224ac0": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00019-of-00048.safetensors", "size": 385894152}, "dd733b38709fc6209d50e7b232fca7d0c3fb75dd26cd13c9924fe1c6fc95d860": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00020-of-00048.safetensors", "size": 385894152}, "7abcd88567f9de99d0b7563472178694540d91ca030d275ec5651d735eab726e": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00021-of-00048.safetensors", "size": 385894152}, "130ef32dbdf2a463d7b9216fb90bb351a1af8a3974c23ebf3cad8efe25bc01e6": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00022-of-00048.safetensors", "size": 385894152}, "cb68dfdbee7f809a253201e6ee515d84c5354c6ef70b0e16ad3dc624c3f3b2c2": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00023-of-00048.safetensors", "size": 385894152}, "0ed6929536a99741a63b2cee15cc1bb7d9f77ddcf3edfe1d163d7ab5fcaa1e5d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00024-of-00048.safetensors", "size": 385894152}, "29668e2887f5b63de4bdb016a14121407801e1189e24c07a31ce774bf070eb15": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00025-of-00048.safetensors", "size": 385894152}, "11671a0c9cef106550bfd56d7ab588fe85c79001b2c4c5aeed77e511192fccf8": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00026-of-00048.safetensors", "size": 385894152}, "f318b6b4e063bd0e9b93a300151f8c9a367610ab4a28893a2d911b1a44ec51a2": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00027-of-00048.safetensors", "size": 385894152}, "9ff622627db5da65e548357109de4bb10331a04671340f4cdf3c8e210700ec3c": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00028-of-00048.safetensors", "size": 385894152}, "d30758486725a17873f8cfc9bae90daedf88f37aacae9a07b53c40503de55f20": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00029-of-00048.safetensors", "size": 385894152}, "e16401b15371064adf2ccf5f7640a56044e0b114cdffc5357460bddb4fbbcf73": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00030-of-00048.safetensors", "size": 385894152}, "af25a25b7a5a9c2c634cdf840391676f6481c5fa81fb76b85a4d38f586b40a7d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00031-of-00048.safetensors", "size": 385894152}, "9dc3b8e17a9be8b670331d6d79d4eb0d943cba07f3d68ed208ff8c469bce671e": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00032-of-00048.safetensors", "size": 385894152}, "f7a0e15fa315ef9e6722de95c43bdd454d80ae1c71b85c4cf880f5d54173c39d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00033-of-00048.safetensors", "size": 385894152}, "b7156d00c719c49e471146930fa1697b3cb99aa8e5606701e983db1fabb47d6d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00034-of-00048.safetensors", "size": 385894152}, "30a80b6b4582014ae613a3ec4a807b82e9b36adcc946bab1cbb98e795897700e": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00035-of-00048.safetensors", "size": 385894152}, "768abad0bbd7c606b603d1eba5cacdf93a49d4c07a2dfe737d7cb63c15d6ad32": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00036-of-00048.safetensors", "size": 385894152}, "7882a7ddabe655dfcd09ec04c16bac56e4a7942544438f2d02cb10f59cf60843": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00037-of-00048.safetensors", "size": 385894152}, "7c47ec26724811b813e4d0568bc8a18b27360b979bce0a4f6c905a913b2fff1b": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00038-of-00048.safetensors", "size": 1739071824}, "29c86ffd0951470a0c32ff7a3840bf6673bf1a953190be2af1c2d2c4598f43e7": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00039-of-00048.safetensors", "size": 50463208}, "afc13130962b4bb346db8dbd06e37d4b0faf1543cb9c3c4704172ba7c489115d": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00040-of-00048.safetensors", "size": 16777480}, "03508eed1b8d6f7ec042bf4139ac7c101e9e8d64038fe2de423d1dbe3b93e034": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00041-of-00048.safetensors", "size": 16777480}, "ee743120815778e694c747ce6c57120c7f27d35005a099c6904443ba17d05b0c": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00042-of-00048.safetensors", "size": 109060744}, "f548dee6c2e9deba7e04451843794d581cc58691a28fc42ffe2099381fd2ab88": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00043-of-00048.safetensors", "size": 285230240}, "dab8447646b085b185441bda9f5010408c55a43c59a5fc496f25dcde429546b0": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00044-of-00048.safetensors", "size": 285230240}, "bfb04b889e83dec4321bc380d38bbb45760113ecf0e20cdaeda38c0e1e99136b": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00045-of-00048.safetensors", "size": 285230240}, "75660a0d42c4ef9f813ba98d28b64859e0b86bfa3165953ebeeee3a12d9574ad": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/qwen_7B/qwen_7B/model-00046-of-00048.safetensors", "size": 184566536}, "80e86ab006bb5c8d4f223205045035a1c77b2bb9c3be9a86d7e740bbafe5ddf0": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/rvq_depth_decoder/diffusion_pytorch_model.safetensors", "size": 1292055248}, "b1537fa9e59a537276ecbc2e12d0438edff635a1f4a4948e679774b5feb3e610": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/tokenizer/tokenizer.json", "size": 11423801}, "1943baebe93b5d5a57e9e1f603d9cef51a73a55e7a42f52913932dc06dcf10f0": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/transformer/diffusion_pytorch_model-00001-of-00002.safetensors", "size": 4959921384}, "b2f9e29d241e107e5a281f8b369d6db48eee983917df966c56d7b8dd0bd482c2": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/transformer/diffusion_pytorch_model-00002-of-00002.safetensors", "size": 4767750800}, "daf0bf0560ea978ce7b5ec3e82f420a44429efef18bdfbe3c714d55ceffbe934": {"lineages": ["Music3"], "file": "MiniMaxAI/MiniMax-Music3/vocoder/diffusion_pytorch_model.safetensors", "size": 216695272}}, "probes": []}
|
code/hfeco/family.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
"""What a model family has to define. Everything else in hfeco is family-agnostic.
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"""
|
| 8 |
import json
|
| 9 |
import re
|
|
@@ -20,6 +29,28 @@ class Member:
|
|
| 20 |
text_hint: Optional[re.Pattern] = None # how cards/names refer to this member specifically
|
| 21 |
tracked: bool = True # False: still classified (so its derivatives are kept out of
|
| 22 |
# the others), but not on the dashboard or in PR candidates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
@dataclass
|
|
@@ -27,7 +58,7 @@ class Family:
|
|
| 27 |
key: str # storage / URL key, e.g. "h3"
|
| 28 |
title: str # shown on the dashboard
|
| 29 |
members: list
|
| 30 |
-
default_member: str
|
| 31 |
|
| 32 |
# discovery
|
| 33 |
name_queries: list # Hub name search (substring of repo id)
|
|
@@ -37,12 +68,14 @@ class Family:
|
|
| 37 |
name_hint: re.Pattern = None # names worth probing even without other signals
|
| 38 |
|
| 39 |
# structural evidence (tier 1)
|
|
|
|
|
|
|
|
|
|
| 40 |
sig_dims: set = field(default_factory=set) # hidden sizes that identify the family's
|
| 41 |
-
sig_names: re.Pattern = None # block tensors (with sig_names)
|
| 42 |
marker_rules: list = field(default_factory=list) # (regex on tensor names, lineage, reason, full_weights_only)
|
| 43 |
meta_rules: list = field(default_factory=list) # (regex on safetensors __metadata__, lineage, reason)
|
| 44 |
index_rules: list = field(default_factory=list) # (substring of model_index.json, lineage)
|
| 45 |
-
config_rules: list = field(default_factory=list) # (regex on config model_type/architectures, lineage)
|
| 46 |
extra_structural: Optional[Callable] = None # fn(ev, ctx) -> [(lineage, reason)]
|
| 47 |
probe_names: list = field(default_factory=list) # tensor names for the value probe
|
| 48 |
probe_prefixes: tuple = ("model.diffusion_model.", "diffusion_model.", "transformer.", "model.", "")
|
|
@@ -50,12 +83,15 @@ class Family:
|
|
| 50 |
|
| 51 |
# tier 2: card text rules (regex on README, lineage, weight, reason, skip_for_text_llm)
|
| 52 |
card_rules: list = field(default_factory=list)
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# text models around the family
|
| 55 |
text_member: Optional[str] = None # lineage of an official text-model member (e.g. PE)
|
| 56 |
text_member_hint: Optional[re.Pattern] = None # card wording about the text member (tier 2 only)
|
| 57 |
text_member_name: Optional[re.Pattern] = None # the text member named in a repo id or tags
|
| 58 |
text_component: Optional[re.Pattern] = None # e.g. the family's own text encoder
|
|
|
|
| 59 |
component_names: Optional[re.Pattern] = None
|
| 60 |
native_quant: dict = field(default_factory=dict) # lineage -> regex of the member's own quant format
|
| 61 |
# Publishers with many ordinary repos: their few adult repos are hidden one by one, the rest stay
|
|
@@ -74,7 +110,8 @@ class Family:
|
|
| 74 |
|
| 75 |
@property
|
| 76 |
def bases(self):
|
| 77 |
-
|
|
|
|
| 78 |
|
| 79 |
def member(self, lineage):
|
| 80 |
return next(m for m in self.members if m.lineage == lineage)
|
|
@@ -83,7 +120,7 @@ class Family:
|
|
| 83 |
return self.member(lineage).base
|
| 84 |
|
| 85 |
def lineage_of_base(self):
|
| 86 |
-
return {
|
| 87 |
|
| 88 |
def reference_path(self):
|
| 89 |
return Path(__file__).parent / "families" / f"{self.key}_reference.json"
|
|
|
|
| 1 |
"""What a model family has to define. Everything else in hfeco is family-agnostic.
|
| 2 |
|
| 3 |
+
A family is a set of official models that have to be told apart from each other (H3 vs
|
| 4 |
+
H3-Image, M2 vs M2.5). Each one lives in hfeco/families/<key>.py and fills in the same
|
| 5 |
+
three tiers of evidence that hfeco/classify.py applies to every family:
|
| 6 |
+
|
| 7 |
+
1. structure the weights themselves: file hashes, tensor sizes and markers, value probes,
|
| 8 |
+
the architecture named by config.json or the GGUF header (`archs`)
|
| 9 |
+
2. statements declared base_model, model card text, sample media, creation date
|
| 10 |
+
3. names the repo name alone (low confidence at most)
|
| 11 |
+
|
| 12 |
+
To add one: write hfeco/families/<key>.py, register it in hfeco/families/__init__.py, run
|
| 13 |
+
scripts/build_reference.py --family <key>, then scripts/daily.py --family <key>, and point
|
| 14 |
+
its releases at it in hfeco/org.py (RELEASES). Storage, the daily job and the page pick it
|
| 15 |
+
up by its key.
|
| 16 |
"""
|
| 17 |
import json
|
| 18 |
import re
|
|
|
|
| 29 |
text_hint: Optional[re.Pattern] = None # how cards/names refer to this member specifically
|
| 30 |
tracked: bool = True # False: still classified (so its derivatives are kept out of
|
| 31 |
# the others), but not on the dashboard or in PR candidates
|
| 32 |
+
also: tuple = () # other official repos of the same release (M1-40k next to M1-80k)
|
| 33 |
+
|
| 34 |
+
@property
|
| 35 |
+
def repos(self):
|
| 36 |
+
return (self.base, *self.also)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@dataclass
|
| 40 |
+
class Arch:
|
| 41 |
+
"""A weight layout the family ships, as config.json (model_type / architectures) or a GGUF
|
| 42 |
+
header (general.architecture) names it. Members that share one layout (M2 ... M2.7) are told
|
| 43 |
+
apart by the other evidence; the hidden size keeps out test models that reuse the
|
| 44 |
+
architecture at toy sizes (expert or layer pruning leaves it unchanged)."""
|
| 45 |
+
members: tuple # lineages that ship this layout
|
| 46 |
+
names: re.Pattern # matched against model_type, architectures, general.architecture
|
| 47 |
+
hidden: Optional[int] = None # config hidden_size / GGUF <arch>.embedding_length
|
| 48 |
+
vocab: Optional[int] = None # config vocab_size / GGUF token count (Music3's LM is a Qwen3 with its own vocabulary)
|
| 49 |
+
strict: bool = False # the sizes must be stated, not just not contradict (for names other models share)
|
| 50 |
+
|
| 51 |
+
@property
|
| 52 |
+
def label(self):
|
| 53 |
+
return " / ".join(self.members)
|
| 54 |
|
| 55 |
|
| 56 |
@dataclass
|
|
|
|
| 58 |
key: str # storage / URL key, e.g. "h3"
|
| 59 |
title: str # shown on the dashboard
|
| 60 |
members: list
|
| 61 |
+
default_member: Optional[str] # a generic mention of the family means this member (None: no such member)
|
| 62 |
|
| 63 |
# discovery
|
| 64 |
name_queries: list # Hub name search (substring of repo id)
|
|
|
|
| 68 |
name_hint: re.Pattern = None # names worth probing even without other signals
|
| 69 |
|
| 70 |
# structural evidence (tier 1)
|
| 71 |
+
archs: list = field(default_factory=list) # Arch per layout (checkpoints with a config / GGUF header)
|
| 72 |
+
own_llm: bool = False # the family ships language models itself (M series, Music3's LM): LLM-shaped
|
| 73 |
+
# weights count as its own unless their layout is another model's
|
| 74 |
sig_dims: set = field(default_factory=set) # hidden sizes that identify the family's
|
| 75 |
+
sig_names: re.Pattern = None # block tensors (with sig_names), for DiTs without a config
|
| 76 |
marker_rules: list = field(default_factory=list) # (regex on tensor names, lineage, reason, full_weights_only)
|
| 77 |
meta_rules: list = field(default_factory=list) # (regex on safetensors __metadata__, lineage, reason)
|
| 78 |
index_rules: list = field(default_factory=list) # (substring of model_index.json, lineage)
|
|
|
|
| 79 |
extra_structural: Optional[Callable] = None # fn(ev, ctx) -> [(lineage, reason)]
|
| 80 |
probe_names: list = field(default_factory=list) # tensor names for the value probe
|
| 81 |
probe_prefixes: tuple = ("model.diffusion_model.", "diffusion_model.", "transformer.", "model.", "")
|
|
|
|
| 83 |
|
| 84 |
# tier 2: card text rules (regex on README, lineage, weight, reason, skip_for_text_llm)
|
| 85 |
card_rules: list = field(default_factory=list)
|
| 86 |
+
# tier 2: what a GGUF header says it was converted from (general.name / base_model; lineage, reason)
|
| 87 |
+
header_rules: list = field(default_factory=list)
|
| 88 |
|
| 89 |
# text models around the family
|
| 90 |
text_member: Optional[str] = None # lineage of an official text-model member (e.g. PE)
|
| 91 |
text_member_hint: Optional[re.Pattern] = None # card wording about the text member (tier 2 only)
|
| 92 |
text_member_name: Optional[re.Pattern] = None # the text member named in a repo id or tags
|
| 93 |
text_component: Optional[re.Pattern] = None # e.g. the family's own text encoder
|
| 94 |
+
text_component_why: str = "是这个家族自带的文本编码器"
|
| 95 |
component_names: Optional[re.Pattern] = None
|
| 96 |
native_quant: dict = field(default_factory=dict) # lineage -> regex of the member's own quant format
|
| 97 |
# Publishers with many ordinary repos: their few adult repos are hidden one by one, the rest stay
|
|
|
|
| 110 |
|
| 111 |
@property
|
| 112 |
def bases(self):
|
| 113 |
+
"""Every official repo of the family."""
|
| 114 |
+
return [r for m in self.members for r in m.repos]
|
| 115 |
|
| 116 |
def member(self, lineage):
|
| 117 |
return next(m for m in self.members if m.lineage == lineage)
|
|
|
|
| 120 |
return self.member(lineage).base
|
| 121 |
|
| 122 |
def lineage_of_base(self):
|
| 123 |
+
return {r: m.lineage for m in self.members for r in m.repos}
|
| 124 |
|
| 125 |
def reference_path(self):
|
| 126 |
return Path(__file__).parent / "families" / f"{self.key}_reference.json"
|
code/hfeco/metrics.py
CHANGED
|
@@ -57,16 +57,25 @@ def latest_daily(dd):
|
|
| 57 |
return d.groupby("repo_id").daily.last().to_dict()
|
| 58 |
|
| 59 |
|
| 60 |
-
def build(raw, labels, hf_tree_counts, fam, authors=None):
|
| 61 |
"""The dashboard's data file. The Space may become public, so this is a whitelist of
|
| 62 |
what the page renders: no evidence, confidence, declaration status or flags, and no
|
| 63 |
names of NSFW repos (they still count in the totals). Internal detail stays in the
|
| 64 |
-
labels parquet in the private dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
days = sorted(raw.day.unique())
|
| 66 |
today = days[-1]
|
| 67 |
lab = pd.DataFrame(labels)
|
| 68 |
cur = raw[raw.day == today].merge(lab, on=["kind", "repo_id"], how="left")
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
dd = dd[dd.kind == "model"]
|
| 71 |
last = latest_daily(dd)
|
| 72 |
famdf = cur[cur.family.fillna(False).astype(bool)]
|
|
|
|
| 57 |
return d.groupby("repo_id").daily.last().to_dict()
|
| 58 |
|
| 59 |
|
| 60 |
+
def build(raw, labels, hf_tree_counts, fam, authors=None, history=None):
|
| 61 |
"""The dashboard's data file. The Space may become public, so this is a whitelist of
|
| 62 |
what the page renders: no evidence, confidence, declaration status or flags, and no
|
| 63 |
names of NSFW repos (they still count in the totals). Internal detail stays in the
|
| 64 |
+
labels parquet in the private dataset.
|
| 65 |
+
|
| 66 |
+
`history`: earlier snapshots of the same repos taken by another pass (the org-wide one
|
| 67 |
+
followed the language and music releases before they had a family), so daily downloads
|
| 68 |
+
carry on across the switch. On a day both have, the family's own snapshot wins."""
|
| 69 |
days = sorted(raw.day.unique())
|
| 70 |
today = days[-1]
|
| 71 |
lab = pd.DataFrame(labels)
|
| 72 |
cur = raw[raw.day == today].merge(lab, on=["kind", "repo_id"], how="left")
|
| 73 |
+
counters = raw
|
| 74 |
+
if history is not None and len(history):
|
| 75 |
+
cols = ["repo_id", "day", "fetched_at", "downloads_all_time", "downloads_30d"]
|
| 76 |
+
h = history[history.repo_id.isin(set(raw.repo_id)) & ~history.day.isin(set(days))][cols]
|
| 77 |
+
counters = pd.concat([h.assign(kind="model"), raw[["kind"] + cols]], ignore_index=True)
|
| 78 |
+
dd = daily_downloads(counters)
|
| 79 |
dd = dd[dd.kind == "model"]
|
| 80 |
last = latest_daily(dd)
|
| 81 |
famdf = cur[cur.family.fillna(False).astype(bool)]
|
code/hfeco/org.py
CHANGED
|
@@ -29,16 +29,16 @@ CATEGORY_NAME = {"video": "Video", "language": "Language", "image": "Image", "mu
|
|
| 29 |
RELEASES = [
|
| 30 |
("h3-image", "MiniMax-H3-Image", "image", r"MiniMax-H3-Image", ("h3", "H3-Image")),
|
| 31 |
("h3", "MiniMax-H3", "video", r"MiniMax-H3", ("h3", "H3")),
|
| 32 |
-
("music3", "MiniMax-Music3", "music", r"MiniMax-Music3(-.+)?",
|
| 33 |
-
("m3.1-flash", "MiniMax-M3.1-Flash", "language", r"MiniMax-M3\.1-Flash(-.+)?",
|
| 34 |
-
("m3", "MiniMax-M3", "language", r"MiniMax-M3(-.+)?",
|
| 35 |
-
("m2.7", "MiniMax-M2.7", "language", r"MiniMax-M2\.7(-.+)?",
|
| 36 |
-
("m2.5", "MiniMax-M2.5", "language", r"MiniMax-M2\.5(-.+)?",
|
| 37 |
-
("m2.1", "MiniMax-M2.1", "language", r"MiniMax-M2\.1(-.+)?",
|
| 38 |
-
("m2", "MiniMax-M2", "language", r"MiniMax-M2(-.+)?",
|
| 39 |
-
("m1", "MiniMax-M1", "language", r"MiniMax-M1-.+",
|
| 40 |
-
("text-01", "MiniMax-Text-01", "language", r"MiniMax-Text-01(-.+)?",
|
| 41 |
-
("vl-01", "MiniMax-VL-01", "language", r"MiniMax-VL-01(-.+)?",
|
| 42 |
("synlogic", "SynLogic", "language", r"SynLogic-.+", None),
|
| 43 |
("vtp", "VTP", "image", r"VTP-.+", None),
|
| 44 |
]
|
|
@@ -300,7 +300,8 @@ def build(rels, found, deep_data, who):
|
|
| 300 |
"dlall": sum(getattr(m, "downloads_all_time", None) or 0 for m in off),
|
| 301 |
"likes": sum(m.likes or 0 for m in off)}
|
| 302 |
lineages[key] = lin
|
| 303 |
-
repos[key] = [{**x, "lin": key
|
|
|
|
| 304 |
lab = labels[fam]
|
| 305 |
mine = lab[(lab.lineage == lk) & ~lab.repo_id.str.startswith(ORG + "/")]
|
| 306 |
ids[key] = ({m.id for m in off}, set(mine.repo_id))
|
|
|
|
| 29 |
RELEASES = [
|
| 30 |
("h3-image", "MiniMax-H3-Image", "image", r"MiniMax-H3-Image", ("h3", "H3-Image")),
|
| 31 |
("h3", "MiniMax-H3", "video", r"MiniMax-H3", ("h3", "H3")),
|
| 32 |
+
("music3", "MiniMax-Music3", "music", r"MiniMax-Music3(-.+)?", ("music", "Music3")),
|
| 33 |
+
("m3.1-flash", "MiniMax-M3.1-Flash", "language", r"MiniMax-M3\.1-Flash(-.+)?", ("m", "M3.1-Flash")),
|
| 34 |
+
("m3", "MiniMax-M3", "language", r"MiniMax-M3(-.+)?", ("m", "M3")),
|
| 35 |
+
("m2.7", "MiniMax-M2.7", "language", r"MiniMax-M2\.7(-.+)?", ("m", "M2.7")),
|
| 36 |
+
("m2.5", "MiniMax-M2.5", "language", r"MiniMax-M2\.5(-.+)?", ("m", "M2.5")),
|
| 37 |
+
("m2.1", "MiniMax-M2.1", "language", r"MiniMax-M2\.1(-.+)?", ("m", "M2.1")),
|
| 38 |
+
("m2", "MiniMax-M2", "language", r"MiniMax-M2(-.+)?", ("m", "M2")),
|
| 39 |
+
("m1", "MiniMax-M1", "language", r"MiniMax-M1-.+", ("m", "M1")),
|
| 40 |
+
("text-01", "MiniMax-Text-01", "language", r"MiniMax-Text-01(-.+)?", ("m", "Text-01")),
|
| 41 |
+
("vl-01", "MiniMax-VL-01", "language", r"MiniMax-VL-01(-.+)?", ("m", "VL-01")),
|
| 42 |
("synlogic", "SynLogic", "language", r"SynLogic-.+", None),
|
| 43 |
("vtp", "VTP", "image", r"VTP-.+", None),
|
| 44 |
]
|
|
|
|
| 300 |
"dlall": sum(getattr(m, "downloads_all_time", None) or 0 for m in off),
|
| 301 |
"likes": sum(m.likes or 0 for m in off)}
|
| 302 |
lineages[key] = lin
|
| 303 |
+
repos[key] = [{**x, "lin": key, "up": r["base"] if x["up"].startswith(ORG + "/") else x["up"]}
|
| 304 |
+
for x in src["repos"] if x["lin"] == lk] # one centre per release
|
| 305 |
lab = labels[fam]
|
| 306 |
mine = lab[(lab.lineage == lk) & ~lab.repo_id.str.startswith(ORG + "/")]
|
| 307 |
ids[key] = ({m.id for m in off}, set(mine.repo_id))
|
code/scripts/build_reference.py
CHANGED
|
@@ -16,12 +16,12 @@ 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",
|
| 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"{
|
| 25 |
"size": s.size})
|
| 26 |
if m.lineage not in e["lineages"]:
|
| 27 |
e["lineages"].append(m.lineage)
|
|
|
|
| 16 |
fam = families.get(ap.parse_args().family)
|
| 17 |
|
| 18 |
ref = {"sha256": {}, "probes": []}
|
| 19 |
+
for m, repo in [(m, r) for m in fam.members for r in m.repos]:
|
| 20 |
+
for s in hub.info("model", repo, 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"{repo}/{s.rfilename}",
|
| 25 |
"size": s.size})
|
| 26 |
if m.lineage not in e["lineages"]:
|
| 27 |
e["lineages"].append(m.lineage)
|
code/scripts/daily.py
CHANGED
|
@@ -40,6 +40,7 @@ if args.push:
|
|
| 40 |
log("pull dataset")
|
| 41 |
store.pull()
|
| 42 |
|
|
|
|
| 43 |
for key in args.family:
|
| 44 |
fam = families.get(key)
|
| 45 |
log(f"== {fam.title}")
|
|
@@ -50,8 +51,17 @@ for key in args.family:
|
|
| 50 |
raw = store.read_raw(fam.key)
|
| 51 |
today = raw[raw.day == raw.day.max()]
|
| 52 |
cache, cache_path = pipeline.enrich_all(today, fam, log=log)
|
| 53 |
-
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
lab_path = store.LOCAL / "labels" / fam.key / "latest.parquet"
|
| 56 |
lab_path.parent.mkdir(parents=True, exist_ok=True)
|
| 57 |
ldf = pd.DataFrame(labels)
|
|
@@ -61,7 +71,8 @@ for key in args.family:
|
|
| 61 |
|
| 62 |
fam_ids = [x["repo_id"] for x in labels if x.get("family") and x["kind"] == "model"]
|
| 63 |
who, who_path = authors.update({i.split("/")[0] for i in fam_ids} | {b.split("/")[0] for b in fam.bases}, log=log)
|
| 64 |
-
|
|
|
|
| 65 |
data_path = store.LOCAL / "dashboard" / f"{fam.key}.json"
|
| 66 |
metrics.dump(data, data_path)
|
| 67 |
log(f"{fam.key}: {len(labels)} labels, {len(data['repos'])} repos on the dashboard")
|
|
|
|
| 40 |
log("pull dataset")
|
| 41 |
store.pull()
|
| 42 |
|
| 43 |
+
run = {}
|
| 44 |
for key in args.family:
|
| 45 |
fam = families.get(key)
|
| 46 |
log(f"== {fam.title}")
|
|
|
|
| 51 |
raw = store.read_raw(fam.key)
|
| 52 |
today = raw[raw.day == raw.day.max()]
|
| 53 |
cache, cache_path = pipeline.enrich_all(today, fam, log=log)
|
| 54 |
+
run[key] = (raw, today, cache_path, classify.classify_all(today, cache, fam))
|
| 55 |
|
| 56 |
+
# One repo counts in one family; families not run today take part with their latest labels.
|
| 57 |
+
others = {k: pd.read_parquet(p).to_dict("records") for k in families.FAMILIES if k not in run
|
| 58 |
+
for p in [store.LOCAL / "labels" / k / "latest.parquet"] if p.exists()}
|
| 59 |
+
moved = classify.resolve_overlaps({k: v[3] for k, v in run.items()}, others)
|
| 60 |
+
if moved:
|
| 61 |
+
log(f"claimed by more than one family, kept in the strongest: {moved}")
|
| 62 |
+
|
| 63 |
+
for key, (raw, today, cache_path, labels) in run.items():
|
| 64 |
+
fam = families.get(key)
|
| 65 |
lab_path = store.LOCAL / "labels" / fam.key / "latest.parquet"
|
| 66 |
lab_path.parent.mkdir(parents=True, exist_ok=True)
|
| 67 |
ldf = pd.DataFrame(labels)
|
|
|
|
| 71 |
|
| 72 |
fam_ids = [x["repo_id"] for x in labels if x.get("family") and x["kind"] == "model"]
|
| 73 |
who, who_path = authors.update({i.split("/")[0] for i in fam_ids} | {b.split("/")[0] for b in fam.bases}, log=log)
|
| 74 |
+
history = org.read_snapshots() if any((store.LOCAL / "raw" / "org").glob("*.parquet")) else None
|
| 75 |
+
data = metrics.build(raw, labels, metrics.hf_tree_counts(today, fam), fam, who, history=history)
|
| 76 |
data_path = store.LOCAL / "dashboard" / f"{fam.key}.json"
|
| 77 |
metrics.dump(data, data_path)
|
| 78 |
log(f"{fam.key}: {len(labels)} labels, {len(data['repos'])} repos on the dashboard")
|