trace-vla-code / code /sera_v4 /tools /apply_dashboard_trainpage_uf.py
phammminhhieu's picture
TRACE-VLA code snapshot 2026-11-22 11:47 +07: 456 canonical files + SHA256 manifest + sync report
b4396f0 verified
Raw History Blame Contribute Delete
4.72 kB
#!/usr/bin/env python3
"""Repoint the dashboard /train page from the stopped run
sera-v4-fs1-jedi-l60k to the new unfreeze run sera-v4-fs1-jedi-l60kuf
(Young's relaunch 2026-11-20 18:37, train PID 2465006, train_uf.py).
Changes (exact-match asserted, layout/features untouched):
- L60K_NAME -> sera-v4-fs1-jedi-l60kuf (drives the exact log path
EXP/<name>.log, the checkpoint root EXP/<name>, one measure folder
and the footer run name).
- Fuzzy matchers tightened "l60k" -> "l60kuf" in _l60k_find_log,
_l60k_ckpt_root, _l60k_measure and _l60k_proc_running so files of
the old stopped run (and the old test-20k watcher) can never leak
into the new run's page; the checkpoint-root scan also skips smoke
dirs (smoke_jedi_l60kuf* sit in EXP and contain digit subdirs).
- _l60k_proc_running also accepts train_uf.py (the new trainer).
- Rollout panel path -> fewshot/results/fs1-jedi-l60kuf20k-cond-b.jsonl
(watcher jedi_l60kuf_test20k.py output for checkpoint 020000).
- Title/H1/header text name the new run and its unfreeze config.
Backup at server.py.bak-trainpageuf-20261120.
"""
import py_compile
import shutil
from pathlib import Path
P = Path.home() / "sera_v4_dashboard" / "server.py"
src = P.read_text()
orig = src
REPLACEMENTS = [
# 1. Run name constant (+ section comment)
("""# --- Trang /train: theo doi run l60k (Young yeu cau 2026-11-20 17:12) ---
L60K_NAME = "sera-v4-fs1-jedi-l60k\"""",
"""# --- Trang /train: theo doi run l60kuf (tro lai tu l60k 2026-11-20) ---
L60K_NAME = "sera-v4-fs1-jedi-l60kuf\""""),
# 2. Rollout result path (test-20k panel)
("""L60K_ROLLOUT_PATH = os.path.join(FS_RES, "fs1-jedi-l60k20k-cond-b.jsonl")""",
"""L60K_ROLLOUT_PATH = os.path.join(FS_RES, "fs1-jedi-l60kuf20k-cond-b.jsonl")"""),
# 3. _l60k_find_log docstring + matcher
(''' """Tu phat hien log train cua run l60k (uu tien dung quy uoc ten)."""''',
''' """Tu phat hien log train cua run l60kuf (uu tien dung quy uoc ten)."""'''),
(""" if "l60k" not in low or not low.endswith(".log"):""",
""" if "l60kuf" not in low or not low.endswith(".log"):"""),
# 4. _l60k_ckpt_root scan: l60kuf only, skip smoke dirs
(""" for fn in os.listdir(EXP):
if "l60k" in fn:""",
""" for fn in os.listdir(EXP):
if "l60kuf" in fn and "smoke" not in fn:"""),
# 5. _l60k_series docstring
(''' """Parse tang dan log train l60k (giu offset trong RAM). None neu''',
''' """Parse tang dan log train l60kuf (giu offset trong RAM). None neu'''),
# 6. _l60k_proc_running: l60kuf + train_uf.py
(""" if "l60k" in cmd and ("train.py" in cmd or "lerobot-train" in cmd
or "train_v4" in cmd):""",
""" if "l60kuf" in cmd and ("train.py" in cmd or "lerobot-train" in cmd
or "train_v4" in cmd or "train_uf" in cmd):"""),
# 7. _l60k_measure docstring + matcher
(''' """File do CPU cua test 20k (*l60k*measure*.txt): DD_task + dv_swap,''',
''' """File do CPU cua test 20k (*l60kuf*measure*.txt): DD_task + dv_swap,'''),
(""" if "l60k" in low and "measure" in low and low.endswith(".txt"):""",
""" if "l60kuf" in low and "measure" in low and low.endswith(".txt"):"""),
# 8. Title + H1 + header subtitle
("""<title>Train l60k — sera-v4-fs1-jedi-l60k</title>""",
"""<title>Train l60kuf — sera-v4-fs1-jedi-l60kuf</title>"""),
(""" <h1>Train — sera-v4-fs1-jedi-l60k</h1>""",
""" <h1>Train — sera-v4-fs1-jedi-l60kuf</h1>"""),
(""" <p>JEDI-lite train lại 60.000 bước (dropout 0,1 + EMA 0,999) · test tại mốc 20.000 trên checkpoint EMA""",
""" <p>JEDI-lite train lại 60.000 bước — mở khoá 4 block vision cuối của TIPSv2, text đóng băng (dropout 0,1 + EMA 0,999) · test tại mốc 20.000 trên checkpoint EMA"""),
# 9. "log not found" message
(""" "Chưa tìm thấy log train của run l60k trên máy — trang sẽ tự hiện số liệu khi train khởi chạy.</div>")""",
""" "Chưa tìm thấy log train của run l60kuf trên máy — trang sẽ tự hiện số liệu khi train khởi chạy.</div>")"""),
]
for i, (old, new) in enumerate(REPLACEMENTS, 1):
assert src.count(old) == 1, "replacement %d: found %d occurrences" % (
i, src.count(old))
src = src.replace(old, new)
assert src != orig
bak = P.with_name("server.py.bak-trainpageuf-20261120")
shutil.copy2(P, bak)
P.write_text(src)
py_compile.compile(str(P), doraise=True)
print("OK: %d replacements applied; backup at %s" % (len(REPLACEMENTS), bak))