v0.5.0: suíte SOM-4D + suíte JEPA (12) + tecnologia Pensamento + telemetria Theil–Sen — 29/29 gates verdes (provas r-18..r-22)
e26f4cc verified Download scripts/53_suite_v050.py from PowerMachine/khtst-rust: direct link, hf CLI and curl.
- Browser
- Download file 5.23 kB
-
https://huggingface.co/PowerMachine/khtst-rust/resolve/c5dc6bb43cd15adcb11b4bbba4be875b48a4ddc4/scripts/53_suite_v050.py
- Command line
-
hf download hf://PowerMachine/khtst-rust@c5dc6bb43cd15adcb11b4bbba4be875b48a4ddc4/scripts/53_suite_v050.py
-
curl -L -o 53_suite_v050.py https://huggingface.co/PowerMachine/khtst-rust/resolve/c5dc6bb43cd15adcb11b4bbba4be875b48a4ddc4/scripts/53_suite_v050.py
5.23 kB
| #!/usr/bin/env python3 | |
| """53_suite_v050.py — Suíte de verificação consolidada v0.5.0. | |
| Agrega: suíte SOM (48), suíte JEPA (49), Pensamento (50), treino real (51), | |
| telemetria (52), suíte V legada (41) e os testes cargo (38/38). Produz o | |
| veredito final com TODOS os gates. Saída: resultados/suite_v050_final.json | |
| """ | |
| import json, os, subprocess, sys | |
| def carrega(pasta, nome): | |
| c = os.path.join(pasta, "resultados", nome) | |
| return json.load(open(c)) if os.path.exists(c) else None | |
| def main(): | |
| pasta = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| res = {"versao": "0.5.0", "fontes": {}, "gates": {}, "contagens": {}} | |
| # 1) suítes já executadas | |
| for arq, nome in [("suite_som_v050.json", "som"), | |
| ("suite_jepa_v050.json", "jepa"), | |
| ("pensamento_v050.json", "pensamento"), | |
| ("treino_v050.json", "treino_real"), | |
| ("telemetria_v050.json", "telemetria")]: | |
| d = carrega(pasta, arq) | |
| if d is None: | |
| print(f"AVISO: {arq} ausente — rode o script correspondente antes") | |
| continue | |
| res["fontes"][nome] = arq | |
| if nome == "som": | |
| res["contagens"][nome] = d["resumo"] | |
| elif nome == "jepa": | |
| res["contagens"][nome] = d["resumo"] | |
| elif nome == "pensamento": | |
| res["contagens"][nome] = d["resumo"] | |
| elif nome == "treino_real": | |
| res["gates"].update({f"treino.{k}": v for k, v in d["gates"].items()}) | |
| res["contagens"][nome] = { | |
| "perda_a": [d["fases"]["a"]["perda_inicial"], d["fases"]["a"]["perda_final"]], | |
| "ce_b": [d["fases"]["b"]["perda_inicial"], d["fases"]["b"]["perda_final"]], | |
| } | |
| elif nome == "telemetria": | |
| for n, s in d["demos"].items(): | |
| if isinstance(s, dict): | |
| res["gates"].update({f"tel.{n}.{g[5:]}": v for g, v in s.items() if g.startswith("gate_")}) | |
| # gates embutidos das suítes | |
| for nome, arq, chave_gates in [("som", "suite_som_v050.json", None), ("jepa", "suite_jepa_v050.json", None)]: | |
| d = carrega(pasta, arq) | |
| if d: | |
| for comp, s in d.get("suites", d.get("variantes", {})).items(): | |
| for g, v in s.items(): | |
| if g.startswith("gate_"): | |
| res["gates"][f"{nome}.{comp}.{g[5:]}"] = v | |
| # 2) suíte V legada (41) | |
| d = carrega(pasta, "suite_v.json") | |
| if d: | |
| res["fontes"]["v_legada"] = "suite_v.json" | |
| vs = {k: v.get("ok") for k, v in d.items() if k.startswith("V") and isinstance(v, dict)} | |
| res["contagens"]["v_legada"] = { | |
| "bloqueadoras_ok": all(vs.get(k, False) for k in | |
| ("V0_modulo", "V1_config", "V4_mascara", "V9_stiefel", "V10_nfe", "V13_mtp_nivel", "V14_ponte")), | |
| "n_verdes": sum(1 for v in vs.values() if v), "n_total": len(vs)} | |
| # 3) testes cargo (contagem rápida sem re-executar: usa o binário de teste) | |
| try: | |
| saida = subprocess.run( | |
| ["bash", "-c", | |
| f"cd '{pasta}' && export PATH=\"$HOME/.cargo/bin:$PATH\" && " | |
| "cargo test --release --lib 2>&1 | grep -E 'test result' | tail -1"], | |
| capture_output=True, text=True, timeout=400) | |
| linha = saida.stdout.strip() | |
| # "test result: ok. 38 passed; 0 failed; ..." | |
| partes = linha.split() | |
| npass = int(partes[3]) if len(partes) > 3 else 0 | |
| nfail = int(partes[5].rstrip(";")) if len(partes) > 5 else -1 | |
| res["contagens"]["cargo_testes"] = {"linha": linha, "passaram": npass, "falharam": nfail} | |
| res["gates"]["cargo.suite_completa"] = nfail == 0 and npass >= 38 | |
| except Exception as e: | |
| res["contagens"]["cargo_testes"] = {"erro": str(e)} | |
| # 4) veredito final | |
| ok = sum(1 for v in res["gates"].values() if v) | |
| tot = len(res["gates"]) | |
| suites_ok = all( | |
| res["contagens"].get(n, {}).get("todos_verdes", False) or | |
| res["contagens"].get(n, {}).get("todas_verdes", False) | |
| for n in ("som", "jepa", "pensamento") | |
| ) | |
| res["veredito_final"] = { | |
| "gates_ok": ok, "gates_totais": tot, | |
| "suites_componentes_verdes": suites_ok, | |
| "v_legada_ok": res["contagens"].get("v_legada", {}).get("bloqueadoras_ok") is True, | |
| "APROVADO": ok == tot and suites_ok and res["contagens"].get("v_legada", {}).get("bloqueadoras_ok") is True, | |
| } | |
| print(f"=== SUÍTE v0.5.0 CONSOLIDADA ===") | |
| print(f" gates agregados: {ok}/{tot}") | |
| for n in ("som", "jepa", "pensamento"): | |
| c = res["contagens"].get(n, {}) | |
| print(f" suíte {n}: {c}") | |
| print(f" V legada: {res['contagens'].get('v_legada')}") | |
| print(f" cargo: {res['contagens'].get('cargo_testes', {}).get('linha', '?')}") | |
| print(f" VEREDITO: {'APROVADO' if res['veredito_final']['APROVADO'] else 'REPROVADO'}") | |
| with open(os.path.join(pasta, "resultados", "suite_v050_final.json"), "w") as f: | |
| json.dump(res, f, indent=1, ensure_ascii=False) | |
| print("salvo: resultados/suite_v050_final.json") | |
| if not res["veredito_final"]["APROVADO"]: | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| main() | |