Upload code/analyze.py with huggingface_hub
Browse files- code/analyze.py +9 -1
code/analyze.py
CHANGED
|
@@ -21,8 +21,16 @@ diag = {r["fork"]: r["diag"] for r in CV if r.get("kind") == "diag"}
|
|
| 21 |
# Reference rows were written by more than one worker, and a later worker that only knew about
|
| 22 |
# one target language would otherwise clobber the languages the first one measured. Merge the
|
| 23 |
# accuracy dicts across every reference record instead of taking the last write.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
refs = {}
|
| 25 |
-
for
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if r.get("kind") == "reference":
|
| 27 |
cur = refs.setdefault(r["arm"], {"arm": r["arm"], "acc": {}, "model": r.get("model")})
|
| 28 |
cur["acc"].update(r.get("acc") or {})
|
|
|
|
| 21 |
# Reference rows were written by more than one worker, and a later worker that only knew about
|
| 22 |
# one target language would otherwise clobber the languages the first one measured. Merge the
|
| 23 |
# accuracy dicts across every reference record instead of taking the last write.
|
| 24 |
+
# NOTE: read these from the RAW ledger, not from `CV`. `load()` keys by record id and keeps the
|
| 25 |
+
# last write, and several workers wrote a "REF_instruct" record -- a worker that only knew about one
|
| 26 |
+
# target language would otherwise silently drop the languages an earlier worker had measured (it
|
| 27 |
+
# did: the Indonesian and Thai Instruct ceilings vanished from the tables).
|
| 28 |
refs = {}
|
| 29 |
+
for _line in (open(f"{RES}/chatvec.jsonl") if os.path.exists(f"{RES}/chatvec.jsonl") else []):
|
| 30 |
+
try:
|
| 31 |
+
r = json.loads(_line)
|
| 32 |
+
except Exception:
|
| 33 |
+
continue
|
| 34 |
if r.get("kind") == "reference":
|
| 35 |
cur = refs.setdefault(r["arm"], {"arm": r["arm"], "acc": {}, "model": r.get("model")})
|
| 36 |
cur["acc"].update(r.get("acc") or {})
|