TRACE-VLA code snapshot 2026-11-22 11:47 +07: 456 canonical files + SHA256 manifest + sync report (part 2)
ae1ed83 verified Download code/trace_dashboard/www/index.html.bak-df2 from phammminhhieu/trace-vla-code: direct link, hf CLI and curl.
- Browser
- Download file 32.7 kB
-
https://huggingface.co/phammminhhieu/trace-vla-code/resolve/main/code/trace_dashboard/www/index.html.bak-df2
- Command line
-
hf download hf://phammminhhieu/trace-vla-code/code/trace_dashboard/www/index.html.bak-df2
-
curl -L -o index.html.bak-df2 https://huggingface.co/phammminhhieu/trace-vla-code/resolve/main/code/trace_dashboard/www/index.html.bak-df2
32.7 kB
| <html lang="vi"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>TRACE-VLA — Dashboard Validation & Train</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet"> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script> | |
| <script>if(!window.Chart){document.write('<script src="/chart.umd.min.js"><\/script>');}</script> | |
| <style> | |
| :root{ | |
| --navy:#002147; --navy-deep:#002b5b; --blue:#00356e; --red:#c4232a; | |
| --ice:#e0ecf9; --page:#f9fcff; --white:#fff; | |
| --border:rgba(0,53,110,.20); --subtle:rgba(0,53,110,.09); | |
| --body-font:Calibri,"Carlito","Segoe UI",Arial,sans-serif; | |
| --heading-font:"Montserrat","Avenir Next","Century Gothic","Lato",Arial,sans-serif; | |
| --muted:#536b85; --label:#61758d; --mint:#56b695; --sky:#4da3ff; --divider:#a8c4e1; | |
| } | |
| *{box-sizing:border-box} | |
| html,body{margin:0;padding:0} | |
| body{background:var(--page);color:var(--navy);font:400 16px/1.5 var(--body-font);overflow-wrap:break-word} | |
| ::selection{background:#c4dbf6} | |
| .ribbon{background:var(--navy-deep);color:#fff} | |
| .ribbon-in{max-width:1320px;margin:0 auto;padding:10px 42px;display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap} | |
| .ribbon .cap{font:700 11px/1.5 var(--heading-font);letter-spacing:.085em;color:#dbe9f8;text-transform:uppercase} | |
| .ribbon .live{font-size:13px;font-weight:700;color:#fff} | |
| .ribbon .live b{color:#a6d6ff} | |
| .wrap{max-width:1320px;margin:0 auto;padding:28px 42px 56px} | |
| h1{font:700 36px/1.33 var(--heading-font);text-transform:uppercase;margin:0 0 6px} | |
| .sub{color:var(--muted);font-size:16px;margin:0 0 8px} | |
| h2{font:700 24px/1.35 var(--heading-font);text-transform:uppercase;margin:0;display:flex;align-items:center;gap:12px} | |
| h2::after{content:"";flex:1;height:1px;background:var(--divider)} | |
| section{margin-top:44px} | |
| .panel{background:var(--white);border:1px solid var(--border);padding:20px 22px;margin-top:18px} | |
| .panel h3{font:700 15px/1.4 var(--heading-font);text-transform:uppercase;margin:0 0 12px;color:var(--navy)} | |
| .note{color:var(--muted);font-size:14px} | |
| .eyebrow{font:700 10px/1.5 var(--heading-font);letter-spacing:.14em;color:var(--red);text-transform:uppercase} | |
| .phase-row{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:18px} | |
| .phase{background:var(--white);border:1px solid var(--border);padding:16px 18px} | |
| .phase .nm{font:700 13px/1.4 var(--heading-font);text-transform:uppercase} | |
| .phase .pc{font:700 28px/1.2 var(--heading-font);color:var(--blue);letter-spacing:-.03em;margin:6px 0 8px} | |
| .bar{height:10px;background:var(--ice);position:relative} | |
| .bar>i{position:absolute;left:0;top:0;bottom:0;background:var(--blue);transition:width .6s ease} | |
| .bar.done>i{background:var(--mint)} | |
| .gates{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:18px} | |
| .gate{background:var(--white);border:1px solid var(--border);padding:16px 18px} | |
| .gate .t{font:700 12px/1.4 var(--heading-font);letter-spacing:.04em;text-transform:uppercase;color:var(--label)} | |
| .gate .v{font:700 20px/1.3 var(--heading-font);margin-top:6px;text-transform:uppercase} | |
| .gate .d{font-size:13px;color:var(--muted);margin-top:4px} | |
| .v-pass{color:#2e7d64}.v-wait{color:var(--label)}.v-fail{color:var(--red)}.v-run{color:var(--blue)} | |
| .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px;margin-top:12px} | |
| .exp{border:1px solid var(--border);background:var(--white);padding:10px 12px;border-left:5px solid #a8c4e1;min-height:64px} | |
| .exp .id{font:700 15px/1.3 var(--heading-font);letter-spacing:.02em} | |
| .exp .st{font-size:12.5px;color:var(--muted);margin-top:3px;line-height:1.35} | |
| .chip{display:inline-block;padding:2px 7px;font:700 10px/1.5 var(--heading-font);letter-spacing:.03em;text-transform:uppercase;margin-top:5px} | |
| .exp.s-done{border-left-color:var(--mint)} .chip.s-done{background:var(--mint);color:#002147} | |
| .exp.s-running{border-left-color:var(--blue)} .chip.s-running{background:var(--blue);color:#fff} | |
| .exp.s-partial{border-left-color:var(--sky)} .chip.s-partial{background:var(--sky);color:#002147} | |
| .exp.s-fail{border-left-color:var(--red)} .chip.s-fail{background:var(--red);color:#fff} | |
| .exp.s-pending{border-left-color:#a8c4e1} .chip.s-pending{background:var(--ice);color:var(--label)} | |
| .exp.s-skipped{opacity:.5} | |
| .chips{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px} | |
| .mchip{border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:12px 4px;min-width:170px} | |
| .mchip .v{font:700 24px/1.2 var(--heading-font);color:var(--blue);letter-spacing:-.02em} | |
| .mchip .l{font-size:13px;color:#4c627d;margin-top:2px} | |
| .run{border:1px solid var(--border);background:var(--white);padding:18px 20px;margin-top:14px} | |
| .run .hd{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:8px} | |
| .run .nm{font:700 17px/1.4 var(--body-font)} | |
| .run .meta{font-size:14px;color:var(--muted)} | |
| .run canvas{margin-top:10px} | |
| .wait{border:1px dashed var(--border);background:var(--page);padding:18px 20px;margin-top:14px;color:var(--muted)} | |
| table{border-collapse:collapse;width:100%;font-size:14.5px} | |
| th{font:700 11.5px/1.4 var(--heading-font);text-transform:uppercase;text-align:left;padding:8px 10px;border-bottom:1px solid var(--border);color:var(--navy)} | |
| td{padding:6px 10px;border-bottom:1px solid var(--subtle);color:var(--navy)} | |
| tr:hover td{background:#e8f2ff} | |
| .tblwrap{max-height:380px;overflow:auto;border:1px solid var(--border);background:var(--white);margin-top:12px} | |
| .mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px} | |
| .mach{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:18px} | |
| .mcard{background:var(--white);border:1px solid var(--border);padding:16px 18px} | |
| .mcard .t{font:700 11px/1.5 var(--heading-font);letter-spacing:.03em;text-transform:uppercase;color:var(--label)} | |
| .mcard .big{font:700 24px/1.2 var(--heading-font);color:var(--blue);margin:6px 0 4px} | |
| .proc{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:var(--muted);white-space:pre-wrap;word-break:break-all;margin-top:8px;line-height:1.6} | |
| footer{margin-top:52px;border-top:1px solid var(--border);padding-top:14px;color:var(--muted);font-size:13.5px} | |
| .chartbox{position:relative;height:300px;margin-top:8px} | |
| .chartbox.sm{height:230px} | |
| .two{display:grid;grid-template-columns:1.6fr 1fr;gap:18px} | |
| @media(max-width:900px){.phase-row,.gates,.mach,.two{grid-template-columns:1fr}.wrap{padding:20px 18px 40px}.ribbon-in{padding:10px 18px}h1{font-size:26px}h2{font-size:18px}} | |
| </style> | |
| </head> | |
| <body> | |
| <div class="ribbon"><div class="ribbon-in"> | |
| <span class="cap">TRACE-VLA · Validation & Training Monitor</span> | |
| <span class="live" id="live">Đang tải dữ liệu…</span> | |
| </div></div> | |
| <div class="wrap"> | |
| <div class="eyebrow">Kiến trúc mới · Đặc tả v2.0 (21/11/2026)</div> | |
| <h1>Dashboard TRACE-VLA</h1> | |
| <p class="sub">Khối trên cùng theo dõi thí nghiệm TRACE-VLA v2 đang chạy (Gate 0, v2 core, R3 thu nhỏ). Các khối bên dưới là lịch sử validation v1.1 đã chốt (Gate A/B/C) và đối chiếu model cũ. Trang tự làm mới mỗi 30 giây từ máy train.</p> | |
| <!-- BLOCK V2 --> | |
| <section style="margin-top:26px"> | |
| <h2>0 · TRACE-VLA v2 — Thí nghiệm đang chạy</h2> | |
| <style> | |
| .v2grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:12px;margin-top:12px} | |
| .v2card{border:1px solid rgba(0,53,110,.16);border-radius:10px;padding:12px 14px;background:#fff} | |
| .v2card h3{margin:0 0 6px;font-size:15px;color:#002147} | |
| .v2card .metric{font-size:13px;color:#33475e;margin-top:4px;line-height:1.5} | |
| .v2badge{display:inline-block;padding:1px 9px;border-radius:99px;font-size:11.5px;font-weight:700;letter-spacing:.02em} | |
| .b-pending{background:#e8edf3;color:#536b85}.b-running{background:#dbeafe;color:#00356e} | |
| .b-done{background:#dcf2e7;color:#14663f}.b-fail{background:#fbe3e4;color:#c4232a} | |
| .b-partial{background:#fdf0d5;color:#8a6100} | |
| .v2bar{height:8px;border-radius:99px;background:#e8edf3;overflow:hidden;margin-top:8px} | |
| .v2bar>i{display:block;height:100%;background:#00356e;border-radius:99px} | |
| </style> | |
| <div id="v2-wait" class="note" style="margin-top:10px">Đang chờ dữ liệu v2…</div> | |
| <h3 style="margin:20px 0 2px;color:#002147">Gate 0 — chẩn đoán không train (checkpoint v1 C02)</h3> | |
| <div class="v2grid" id="v2-gate0"></div> | |
| <h3 style="margin:20px 0 2px;color:#002147">Triển khai v2 core — module mới cạnh v1</h3> | |
| <div class="v2grid" id="v2-core"></div> | |
| <h3 style="margin:20px 0 2px;color:#002147">R3 thu nhỏ — train head grounding (đóng băng phần còn lại)</h3> | |
| <div class="v2grid" id="v2-r3"></div> | |
| <div class="panel" id="v2-loss-panel" style="display:none;margin-top:14px"> | |
| <h3>Loss train R3</h3> | |
| <div class="chartbox sm"><canvas id="ch-v2-loss"></canvas></div> | |
| </div> | |
| <h3 style="margin:20px 0 2px;color:#002147">Data Factory D1/D2 — pilot khả thi (không train)</h3> | |
| <div class="v2grid" id="v2-datafactory"></div> | |
| </section> | |
| <!-- BLOCK 1 --> | |
| <section> | |
| <h2>1 · Tổng quan chuỗi validation</h2> | |
| <div id="prog-line" class="note" style="margin-top:10px"></div> | |
| <div class="phase-row" id="phases"></div> | |
| <div class="gates" id="gates"></div> | |
| <div id="grids"></div> | |
| <div id="status-wait"></div> | |
| </section> | |
| <!-- BLOCK 2 --> | |
| <section> | |
| <h2>2 · Train TRACE-VLA</h2> | |
| <div class="panel"> | |
| <h3>Thông số model & smoke v1.1 — đã kiểm chứng</h3> | |
| <div class="chips"> | |
| <div class="mchip"><div class="v">242.106.378</div><div class="l">Tham số tổng</div></div> | |
| <div class="mchip"><div class="v">46.158.090</div><div class="l">Tham số trainable</div></div> | |
| <div class="mchip"><div class="v">2,052 → 1,065</div><div class="l">Loss FLUX — smoke đường đầy đủ</div></div> | |
| <div class="mchip"><div class="v">0,156 → 0,021</div><div class="l">Loss ECHO — smoke đường đầy đủ</div></div> | |
| </div> | |
| </div> | |
| <div class="panel" id="prof-panel" style="display:none"> | |
| <h3>Profiling — đo trực tiếp trên máy train (từ status.json)</h3> | |
| <div class="chips" id="prof-chips"></div> | |
| </div> | |
| <div id="runs"></div> | |
| </section> | |
| <!-- BLOCK 3 --> | |
| <section> | |
| <h2>3 · Kết quả thí nghiệm đã xong</h2> | |
| <div class="panel"> | |
| <h3>Recall@1 — truy hồi cửa sổ demo (D-pre, Phase A)</h3> | |
| <div class="chartbox sm"><canvas id="ch-recall"></canvas></div> | |
| <p class="note">So sánh các biểu diễn cửa sổ: raw, start_end, endpoint_res, start_end_res, ordered_res (residual có thứ tự của v1.1) và static_episode. Số đọc trực tiếp từ results/dpre_retrieval.json trên máy.</p> | |
| </div> | |
| <div class="tblwrap"><table id="tbl-results"> | |
| <thead><tr><th>File kết quả</th><th>Metric</th><th>Giá trị</th><th>Cập nhật</th></tr></thead> | |
| <tbody></tbody> | |
| </table></div> | |
| <div id="results-wait"></div> | |
| </section> | |
| <!-- BLOCK 4 --> | |
| <section> | |
| <h2>4 · Đối chiếu model cũ (fs1 + JEDI-lite)</h2> | |
| <div class="two"> | |
| <div class="panel"> | |
| <h3>Thang few-shot 100k — 30 task × 3 episode</h3> | |
| <div class="chartbox"><canvas id="ch-old"></canvas></div> | |
| <p class="note">Tổng / nhóm train / held-out tại 5 mốc 60k–100k. Held-out gần như đứng yên ở 0–2/27 trong khi nhóm train tăng — dấu hiệu học thuộc task quen.</p> | |
| </div> | |
| <div class="panel"> | |
| <h3>Phân loại 26 episode held-out fail @100k</h3> | |
| <div class="chartbox"><canvas id="ch-fail"></canvas></div> | |
| <p class="note">Gắp đúng vật nhưng fail: 2 · Gắp nhầm vật: 10 · Không gắp được vật nào: 14.</p> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- BLOCK 5 --> | |
| <section> | |
| <h2>5 · Trạng thái máy train</h2> | |
| <div class="mach" id="mach"></div> | |
| </section> | |
| <footer id="foot">Nguồn dữ liệu: ~/sera_v4_experiments/trace_validation/status_v2.json (v2) · status.json · train_progress.json · results/*.json · nvidia-smi trên máy train.</footer> | |
| </div> | |
| <script> | |
| const NAVY='#002147', BLUE='#00356e', SKY='#4da3ff', RED='#c4232a', MINT='#56b695', MUT='#536b85', GRID='rgba(0,53,110,.09)'; | |
| if(window.Chart){ | |
| Chart.defaults.font.family = 'Calibri,"Carlito","Segoe UI",Arial,sans-serif'; | |
| Chart.defaults.color = MUT; | |
| } | |
| const $ = s => document.querySelector(s); | |
| function escapeHtml(s){return String(s).replace(/[&<>"']/g, c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));} | |
| /* ---------- status model (tolerant: schema experiments/probes + legacy items) ---------- */ | |
| function normStatus(txt){ | |
| if(txt===null||txt===undefined||txt==='') return {cls:'pending', label:'Chờ'}; | |
| const t = String(txt).toUpperCase(); | |
| if(/FAIL|ERROR|LỖI/.test(t)) return {cls:'fail', label:String(txt)}; | |
| if(/RUNNING|ĐANG/.test(t)) return {cls:'running', label:String(txt)}; | |
| if(/PARTIAL/.test(t)) return {cls:'partial', label:String(txt)}; | |
| if(/SKIP|BỎ QUA/.test(t)) return {cls:'skipped', label:String(txt)}; | |
| if(/PASS|DONE|XONG/.test(t)) return {cls:'done', label:String(txt)}; | |
| if(/PENDING|WAIT|CHỜ/.test(t)) return {cls:'pending', label:String(txt)}; | |
| return {cls:'partial', label:String(txt)}; | |
| } | |
| const PHASE_TITLES = {A:'Phase A — Kiểm chứng không train', B:'Phase B — Probe vi mô & tiền kiểm chứng', C:'Phase C — Pilot train 5k updates / arm'}; | |
| function guessPhase(id){ | |
| if(/^A0/.test(id)) return 'A'; | |
| if(/^C0/.test(id)) return 'C'; | |
| return 'B'; | |
| } | |
| function natKey(id){ const m = String(id).match(/^([A-Za-z\-]+)(\d+)$/); return m ? [m[1], parseInt(m[2],10)] : [String(id), 0]; } | |
| function buildModel(sp){ | |
| const d = (sp && sp.data) || {}; | |
| const entries = {}; // id -> {status, note, phase} | |
| if(d.experiments){ | |
| for(const [id,e] of Object.entries(d.experiments)){ | |
| if(e && typeof e==='object') entries[id] = {status:e.status||'', note:e.note||'', phase:(e.phase||'').toUpperCase()||guessPhase(id)}; | |
| else entries[id] = {status:String(e), note:'', phase:guessPhase(id)}; | |
| } | |
| } | |
| if(d.probes){ | |
| for(const [id,e] of Object.entries(d.probes)){ | |
| if(e && typeof e==='object') entries[id] = {status:e.status||'', note:e.note||'', phase:'B'}; | |
| else entries[id] = {status:String(e), note:'', phase:'B'}; | |
| } | |
| } | |
| if(d.items){ // legacy schema {items:{ID:"text"}} | |
| for(const [id,v] of Object.entries(d.items)){ | |
| const ids = id==='A03_A04_A05' ? ['A03','A04','A05'] : [id]; | |
| for(const one of ids){ if(!entries[one]) entries[one] = {status:'', note:String(v), phase:guessPhase(one)}; } | |
| } | |
| } | |
| const markers = (sp && sp.markers) || {}; | |
| for(const [id,v] of Object.entries(markers)){ | |
| if(id==='GateA_md') continue; | |
| if(!entries[id]) entries[id] = {status:v, note:'', phase:guessPhase(id)}; | |
| } | |
| const groups = ['A','B','C'].map(k=>({key:k, title:PHASE_TITLES[k], | |
| entries: Object.entries(entries).filter(([,e])=>e.phase===k) | |
| .map(([id,e])=>Object.assign({id}, e)) | |
| .sort((a,b)=>{ const ka=natKey(a.id), kb=natKey(b.id); return ka[0]<kb[0]?-1:ka[0]>kb[0]?1:ka[1]-kb[1]; }) | |
| })).filter(g=>g.entries.length); | |
| return {d, entries, groups}; | |
| } | |
| function gateList(d, markers){ | |
| if(d.gates && typeof d.gates==='object'){ | |
| return Object.entries(d.gates).sort().map(([k,g])=>{ | |
| g = (g && typeof g==='object') ? g : {verdict:String(g)}; | |
| const v = g.verdict; | |
| return {t:'Gate ' + k.replace(/^gate_/i,'').toUpperCase(), | |
| v: v ? String(v) : 'ĐANG CHỜ', | |
| cls: v ? (/PASS/i.test(v)?'v-pass':/FAIL/i.test(v)?'v-fail':'v-run') : 'v-wait', | |
| d: (g.note || (g.at ? 'Lúc: '+g.at : 'Chưa có verdict')) + (v && g.at ? ' · '+g.at : '')}; | |
| }); | |
| } | |
| const gateA = d.gateA || (markers && markers['GateA_md']); | |
| return [ | |
| {t:'Gate A', v: gateA ? String(gateA).split('(')[0].trim() : '—', cls: gateA ? (/PASS/.test(gateA)?'v-pass':'v-fail') : 'v-wait', d: gateA || 'Chưa có verdict'}, | |
| {t:'Gate B', v:'ĐANG CHỜ', cls:'v-wait', d:'Xét khi Phase B xong'}, | |
| {t:'Gate C', v:'CHƯA TỚI', cls:'v-wait', d:'Xét sau khi các arm Phase C chạy xong'}, | |
| ]; | |
| } | |
| const PROF_LABELS = [ | |
| ['trace_total_params','Tham số TRACE (profiling)', v=>Math.round(v).toLocaleString('vi-VN')], | |
| ['trace_trainable_params','Trainable (profiling)', v=>Math.round(v).toLocaleString('vi-VN')], | |
| ['trace_replan_latency_median_ms','Replan latency — median', v=>v+' ms'], | |
| ['trace_replan_latency_p95_ms','Replan latency — p95', v=>v+' ms'], | |
| ['trace_demo_encode_median_ms','Demo encode — median', v=>v+' ms'], | |
| ['trace_train_vram_mb_micro8','VRAM train (micro-batch 8)', v=>v+' MB'], | |
| ]; | |
| function renderStatus(sp){ | |
| const wait = $('#status-wait'); | |
| if(!sp || !sp.available){ | |
| wait.innerHTML = '<div class="wait">Đang chờ dữ liệu — file status.json của chuỗi validation chưa xuất hiện trên máy. Trang sẽ tự có dữ liệu khi file xuất hiện.</div>'; | |
| $('#phases').innerHTML=''; $('#gates').innerHTML=''; $('#grids').innerHTML=''; $('#prog-line').textContent=''; | |
| return; | |
| } | |
| wait.innerHTML=''; | |
| const {d, groups} = buildModel(sp); | |
| const upd = d.updated_at || sp.updated_at; | |
| $('#prog-line').textContent = (d.program||'TRACE-VLA validation') + (d.started ? ' · Bắt đầu: '+d.started : '') + (d.phase ? ' · Phase hiện tại: '+d.phase : '') + (upd ? ' · status.json cập nhật: '+upd : ''); | |
| let phHtml=''; | |
| for(const g of groups){ | |
| let score=0, skipped=0, done=0; | |
| for(const e of g.entries){ | |
| const s = normStatus(e.status || e.note); | |
| if(s.cls==='done'){ score+=1; done+=1; } else if(s.cls==='partial'||s.cls==='running') score+=0.5; | |
| else if(s.cls==='skipped') skipped+=1; | |
| } | |
| const denom = Math.max(1, g.entries.length - skipped); | |
| const pct = Math.round(100*score/denom); | |
| phHtml += `<div class="phase"><div class="nm">Phase ${g.key}</div><div class="pc">${pct}%</div><div class="bar${pct===100?' done':''}"><i style="width:${pct}%"></i></div><div class="note" style="margin-top:6px">${done}/${g.entries.length} mục xong${skipped? ' · '+skipped+' bỏ qua theo gate':''}</div></div>`; | |
| } | |
| $('#phases').innerHTML = phHtml; | |
| $('#gates').innerHTML = gateList(d, sp.markers).map(g=>`<div class="gate"><div class="t">${escapeHtml(g.t)}</div><div class="v ${g.cls}">${escapeHtml(g.v)}</div><div class="d">${escapeHtml(g.d)}</div></div>`).join(''); | |
| let gh=''; | |
| for(const g of groups){ | |
| gh += `<div class="panel"><h3>${g.title}</h3><div class="grid">`; | |
| for(const e of g.entries){ | |
| const s = normStatus(e.status || e.note); | |
| const chipTxt = s.cls==='done'?'Xong':s.cls==='running'?'Đang chạy':s.cls==='fail'?'Fail':s.cls==='skipped'?'Bỏ qua':s.cls==='partial'?'Một phần':'Chờ'; | |
| const txt = e.note || e.status || 'Chưa bắt đầu'; | |
| gh += `<div class="exp s-${s.cls}"><div class="id">${escapeHtml(e.id)}</div><span class="chip s-${s.cls}">${chipTxt}</span><div class="st" title="${escapeHtml(txt)}">${escapeHtml(txt)}</div></div>`; | |
| } | |
| gh += '</div></div>'; | |
| } | |
| $('#grids').innerHTML = gh; | |
| // profiling chips (Block 2) | |
| const prof = d.profiling; | |
| if(prof && typeof prof==='object'){ | |
| const chips = PROF_LABELS.filter(([k])=>prof[k]!==undefined) | |
| .map(([k,l,f])=>`<div class="mchip"><div class="v">${f(prof[k])}</div><div class="l">${l}</div></div>`).join(''); | |
| if(chips){ $('#prof-chips').innerHTML = chips; $('#prof-panel').style.display=''; } | |
| } | |
| } | |
| /* ---------- train runs ---------- */ | |
| function extractHist(r){ | |
| const h = {labels:[], flux:[], echo:[]}; | |
| const push=(lab,f,e)=>{h.labels.push(lab); h.flux.push(f==null?null:f); h.echo.push(e==null?null:e);}; | |
| const series = r.loss_series || r.loss_history || r.history; | |
| if(Array.isArray(series)){ | |
| for(const p of series){ if(p && typeof p==='object') push(p.step??p.iter??h.labels.length, p.flux??p.loss_flux??p.loss??null, p.echo??p.loss_echo??null); } | |
| } else if(r.losses && Array.isArray(r.losses.flux)){ | |
| r.losses.flux.forEach((f,i)=>push(i, f, Array.isArray(r.losses.echo)? r.losses.echo[i] : null)); | |
| } else if(Array.isArray(r.flux_history)){ | |
| r.flux_history.forEach((f,i)=>push(i, f, Array.isArray(r.echo_history)? r.echo_history[i] : null)); | |
| } | |
| return h; | |
| } | |
| function normRuns(tp){ | |
| if(!tp || !tp.available || tp.data==null) return null; | |
| const d = tp.data; let arr=[]; | |
| if(Array.isArray(d)) arr=d; | |
| else if(Array.isArray(d.runs)) arr=d.runs; | |
| else if(typeof d==='object'){ | |
| if('step' in d || 'current_step' in d || 'loss_history' in d || 'loss_series' in d || 'history' in d) arr=[d]; | |
| else arr=Object.entries(d).filter(([k,v])=>v && typeof v==='object' && !Array.isArray(v)).map(([k,v])=>Object.assign({name:k}, v)); | |
| } | |
| return arr.map((r,i)=>{ | |
| const step = r.step ?? r.current_step ?? r.global_step ?? null; | |
| const total = r.total ?? r.total_steps ?? r.max_steps ?? r.target_steps ?? null; | |
| let pct = r.percent ?? r.pct ?? null; | |
| if(pct==null && step!=null && total) pct = 100*step/total; | |
| return { | |
| name: r.name || r.run || r.id || ('Run '+(i+1)), | |
| step, total, pct, | |
| speed: r.steps_per_sec ?? r.sps ?? r.it_per_sec ?? r.speed ?? null, | |
| eta: r.eta_seconds ?? r.eta ?? null, | |
| status: r.status || null, | |
| hist: extractHist(r), | |
| }; | |
| }); | |
| } | |
| const runCharts = {}; | |
| function fmtEta(s){ if(s==null) return '—'; s=Math.round(s); const h=Math.floor(s/3600), m=Math.floor(s%3600/60); return h>0? `${h} giờ ${m} phút` : `${m} phút`; } | |
| function renderTrain(tp){ | |
| const box = $('#runs'); | |
| const runs = normRuns(tp); | |
| if(!runs || runs.length===0){ | |
| box.innerHTML = '<div class="wait"><b>Đang chờ dữ liệu train.</b> File train_progress.json chưa xuất hiện — các run pilot của Phase C chưa bắt đầu train. Khi chuỗi validation bắt đầu train, khối này sẽ tự hiện thanh tiến độ step, tốc độ, ETA và biểu đồ loss FLUX / ECHO của từng run.</div>'; | |
| return; | |
| } | |
| box.innerHTML = runs.map((r,i)=>{ | |
| const meta = [ | |
| r.status ? 'Trạng thái: '+escapeHtml(String(r.status)) : null, | |
| (r.step!=null) ? 'Step ' + r.step.toLocaleString('vi-VN') + (r.total? ' / ' + r.total.toLocaleString('vi-VN') : '') : null, | |
| (r.speed!=null) ? 'Tốc độ: ' + r.speed + ' step/s' : null, | |
| (r.eta!=null) ? 'ETA: ' + (typeof r.eta==='number' ? fmtEta(r.eta) : escapeHtml(String(r.eta))) : null, | |
| ].filter(Boolean).join(' · '); | |
| return `<div class="run"><div class="hd"><span class="nm">${escapeHtml(r.name)}</span><span class="meta">${meta}</span></div> | |
| ${r.pct!=null? `<div class="bar" style="margin-top:10px"><i style="width:${Math.min(100,Math.max(0,r.pct))}%"></i></div><div class="note" style="margin-top:5px">${r.pct.toFixed(1)}%</div>`:''} | |
| ${r.hist.flux.length? `<canvas id="run-ch-${i}" height="180"></canvas>` : '<p class="note">Chưa có dữ liệu loss.</p>'} | |
| </div>`; | |
| }).join(''); | |
| runs.forEach((r,i)=>{ | |
| if(!r.hist.flux.length || !window.Chart) return; | |
| const el = document.getElementById('run-ch-'+i); if(!el) return; | |
| if(runCharts[i]) runCharts[i].destroy(); | |
| const ds=[{label:'Loss FLUX', data:r.hist.flux, borderColor:BLUE, backgroundColor:BLUE, tension:.25, pointRadius:0, borderWidth:2}]; | |
| if(r.hist.echo.some(v=>v!=null)) ds.push({label:'Loss ECHO', data:r.hist.echo, borderColor:SKY, backgroundColor:SKY, tension:.25, pointRadius:0, borderWidth:2}); | |
| runCharts[i] = new Chart(el, {type:'line', data:{labels:r.hist.labels, datasets:ds}, | |
| options:{responsive:true, interaction:{mode:'index',intersect:false}, scales:{x:{title:{display:true,text:'Step'},grid:{color:GRID}}, y:{grid:{color:GRID}}}, plugins:{legend:{labels:{boxWidth:12}}}}}); | |
| }); | |
| } | |
| /* ---------- results ---------- */ | |
| let recallChart=null; | |
| function renderResults(rp){ | |
| const tb = document.querySelector('#tbl-results tbody'); | |
| if(!rp || !rp.available || !rp.files.length){ | |
| $('#results-wait').innerHTML = '<div class="wait">Đang chờ dữ liệu — thư mục results/ của chuỗi validation chưa có file JSON kết quả.</div>'; | |
| tb.innerHTML=''; return; | |
| } | |
| $('#results-wait').innerHTML=''; | |
| let rows=''; | |
| for(const f of rp.files){ | |
| for(const k of Object.keys(f.metrics)){ | |
| const v = f.metrics[k]; | |
| rows += `<tr><td class="mono">${escapeHtml(f.file)}</td><td class="mono">${escapeHtml(k)}</td><td>${typeof v==='number'? (Number.isInteger(v)? v : v.toFixed(4)) : escapeHtml(String(v))}</td><td>${f.updated_at||''}</td></tr>`; | |
| } | |
| } | |
| tb.innerHTML = rows; | |
| const dpre = rp.files.find(f=>/dpre/i.test(f.file)); | |
| if(dpre){ | |
| const pairs = Object.entries(dpre.metrics).filter(([k])=>/recall@1$/i.test(k)); | |
| if(pairs.length && window.Chart){ | |
| const labels = pairs.map(([k])=>k.replace(/\.recall@1$/i,'')); | |
| const vals = pairs.map(([,v])=>v); | |
| if(recallChart) recallChart.destroy(); | |
| recallChart = new Chart($('#ch-recall'), {type:'bar', | |
| data:{labels, datasets:[{label:'Recall@1', data:vals, backgroundColor: labels.map(l=>/ordered_res/.test(l)? RED : (/static/.test(l)? '#a8c4e1' : BLUE))}]}, | |
| options:{responsive:true, maintainAspectRatio:false, scales:{y:{min:0,max:1,grid:{color:GRID}}, x:{grid:{display:false}}}, plugins:{legend:{display:false}}}}); | |
| } | |
| } | |
| } | |
| /* ---------- machine ---------- */ | |
| function renderMachine(mp){ | |
| const box = $('#mach'); | |
| if(!mp || !mp.available){ box.innerHTML = '<div class="wait">Chưa đọc được trạng thái máy.</div>'; return; } | |
| const g = mp.gpu||{}, dk = mp.disk||{}; | |
| const vramPct = (g.mem_used_mib && g.mem_total_mib) ? Math.round(100*g.mem_used_mib/g.mem_total_mib) : null; | |
| box.innerHTML = ` | |
| <div class="mcard"><div class="t">GPU</div><div class="big">${g.util_pct!=null? g.util_pct+'%' : '—'}</div> | |
| <div class="note">${escapeHtml(g.name||'')} ${g.temp_c!=null? '· '+g.temp_c+'°C':''}</div> | |
| ${vramPct!=null? `<div class="bar" style="margin-top:8px"><i style="width:${vramPct}%"></i></div><div class="note" style="margin-top:5px">VRAM ${Math.round(g.mem_used_mib).toLocaleString('vi-VN')} / ${Math.round(g.mem_total_mib).toLocaleString('vi-VN')} MiB (${vramPct}%)</div>`:''} | |
| </div> | |
| <div class="mcard"><div class="t">Ổ đĩa (home)</div><div class="big">${dk.use_pct||'—'}</div> | |
| <div class="note">Đã dùng ${dk.used||'?'} / ${dk.total||'?'} · Còn trống ${dk.avail||'?'}</div></div> | |
| <div class="mcard"><div class="t">Tiến trình train / eval</div> | |
| ${mp.processes && mp.processes.length? `<div class="proc">${mp.processes.map(escapeHtml).join('\n')}</div>` : '<div class="note" style="margin-top:6px">Không có tiến trình train/eval nào khớp bộ lọc lúc đọc.</div>'} | |
| </div>`; | |
| } | |
| /* ---------- static old-model charts ---------- */ | |
| if(window.Chart) new Chart($('#ch-old'), {type:'line', | |
| data:{labels:['60k','70k','80k','90k','100k'], datasets:[ | |
| {label:'Tổng (/90)', data:[43,44,43,47,45], borderColor:BLUE, backgroundColor:BLUE, tension:.2, pointRadius:3, borderWidth:2}, | |
| {label:'Nhóm train (/63)', data:[41,43,43,46,44], borderColor:SKY, backgroundColor:SKY, tension:.2, pointRadius:3, borderWidth:2}, | |
| {label:'Held-out (/27)', data:[2,1,0,1,1], borderColor:RED, backgroundColor:RED, tension:.2, pointRadius:3, borderWidth:2}, | |
| ]}, | |
| options:{responsive:true, maintainAspectRatio:false, scales:{y:{min:0,max:90,grid:{color:GRID}}, x:{grid:{display:false}}}, plugins:{legend:{labels:{boxWidth:12}}}}}); | |
| if(window.Chart) new Chart($('#ch-fail'), {type:'doughnut', | |
| data:{labels:['Gắp đúng vật nhưng fail (2)','Gắp nhầm vật (10)','Không gắp được vật nào (14)'], | |
| datasets:[{data:[2,10,14], backgroundColor:[SKY, RED, BLUE], borderColor:'#fff', borderWidth:2}]}, | |
| options:{responsive:true, maintainAspectRatio:false, plugins:{legend:{position:'bottom', labels:{boxWidth:12}}}}}); | |
| /* ---------- refresh loop ---------- */ | |
| async function fetchJson(u){ try{ const r = await fetch(u + '?t=' + Date.now()); if(!r.ok) return null; return await r.json(); }catch(e){ return null; } } | |
| /* ---------- v2 block ---------- */ | |
| let v2LossChart = null; | |
| function v2Badge(st){ | |
| const n = normStatus(st); | |
| return `<span class="v2badge b-${n.cls}">${escapeHtml(n.label)}</span>`; | |
| } | |
| function v2Card(title, item){ | |
| if(!item) return ''; | |
| let h = `<div class="v2card"><h3>${escapeHtml(title)} ${v2Badge(item.status)}</h3>`; | |
| if(item.verdict) h += `<div class="metric"><b>Verdict:</b> ${escapeHtml(item.verdict)}</div>`; | |
| if(item.metrics) for(const [k,v] of Object.entries(item.metrics)) | |
| h += `<div class="metric">${escapeHtml(k)}: <b>${escapeHtml(v)}</b></div>`; | |
| if(item.params) h += `<div class="metric">Tham số: <b>${escapeHtml(item.params)}</b></div>`; | |
| if(item.note) h += `<div class="metric">${escapeHtml(item.note)}</div>`; | |
| if(typeof item.pct === 'number'){ | |
| h += `<div class="v2bar"><i style="width:${Math.min(100,item.pct)}%"></i></div>`; | |
| h += `<div class="metric">Tiến độ: <b>${item.pct.toFixed(1)}%</b>${item.step? ` · step ${escapeHtml(item.step)}`:''}${item.loss? ` · loss ${escapeHtml(item.loss)}`:''}</div>`; | |
| } | |
| return h + '</div>'; | |
| } | |
| function renderV2(vp){ | |
| const w = $('#v2-wait'); | |
| if(!vp || !vp.available || !vp.data){ if(w) w.textContent = 'Chưa có dữ liệu v2.'; return; } | |
| const d = vp.data; | |
| if(w) w.textContent = 'Cập nhật: ' + (vp.updated_at || '—') + (d.note ? ' · ' + d.note : ''); | |
| const g = d.gate0 || {}; | |
| $('#v2-gate0').innerHTML = | |
| v2Card('T3 · Object feature matching', g.T3) + | |
| v2Card('T5 · Correct vs feasible swapped demo', g.T5) + | |
| v2Card('T6 · Cùng observation, ba điều kiện demo', g.T6) + | |
| v2Card('T4 · Oracle target region', g.T4); | |
| const c = d.core || {}; | |
| $('#v2-core').innerHTML = | |
| v2Card('Demo Object Binding', c.binding) + | |
| v2Card('Demo-to-Live Correspondence', c.correspondence) + | |
| v2Card('Object-Conditioned Adapter', c.adapter) + | |
| v2Card('Toàn model v2', c.total); | |
| const r = d.r3 || {}; | |
| $('#v2-r3').innerHTML = | |
| v2Card('Dữ liệu scene can thiệp', r.data) + | |
| v2Card('Train heads', r.train) + | |
| v2Card('Đánh giá standalone', r.eval); | |
| const f = d.data_factory || {}; | |
| const dfEl = document.getElementById('v2-datafactory'); | |
| if(dfEl) dfEl.innerHTML = | |
| v2Card('Task 1 · Audit LIBERO', f.audit) + | |
| v2Card('Pilot D1/D2 · cặp scene', f.pilot) + | |
| v2Card('Expert scripted', f.expert) + | |
| v2Card('Kiểm tra toàn vẹn + loader', f.checks) + | |
| v2Card('Cổng GO — Data Factory', f.gate); | |
| const hist = (r.train && r.train.loss_hist) || []; | |
| if(hist.length && window.Chart){ | |
| $('#v2-loss-panel').style.display = ''; | |
| const ctx = document.getElementById('ch-v2-loss'); | |
| if(!v2LossChart){ | |
| v2LossChart = new Chart(ctx, {type:'line', data:{labels:hist.map((_,i)=>i+1), | |
| datasets:[{label:'CE loss', data:hist, borderColor:BLUE, backgroundColor:'rgba(0,53,110,.08)', fill:true, pointRadius:0, borderWidth:2}]}, | |
| options:{responsive:true, animation:false, scales:{x:{title:{display:true,text:'step'}}, y:{title:{display:true,text:'loss'}}}, plugins:{legend:{display:false}}}}); | |
| } else { | |
| v2LossChart.data.labels = hist.map((_,i)=>i+1); | |
| v2LossChart.data.datasets[0].data = hist; | |
| v2LossChart.update('none'); | |
| } | |
| } | |
| } | |
| async function refresh(){ | |
| const [sp, tp, rp, mp, vp] = await Promise.all([fetchJson('/data/status'), fetchJson('/data/train'), fetchJson('/data/results'), fetchJson('/data/machine'), fetchJson('/data/v2')]); | |
| renderV2(vp); | |
| renderStatus(sp); renderTrain(tp); renderResults(rp); renderMachine(mp); | |
| const now = new Date(); | |
| $('#live').innerHTML = 'Tự làm mới mỗi 30 giây · Lần cuối: <b>' + now.toLocaleTimeString('vi-VN') + '</b>'; | |
| const parts=[]; | |
| if(sp && sp.updated_at) parts.push('status.json: '+sp.updated_at); | |
| if(tp && tp.updated_at) parts.push('train_progress.json: '+tp.updated_at); | |
| if(mp && mp.time) parts.push('Máy đọc lúc: '+mp.time); | |
| $('#foot').textContent = 'Nguồn dữ liệu: ~/sera_v4_experiments/trace_validation/status.json · train_progress.json · results/*.json · nvidia-smi trên máy train.' + (parts.length? ' — ' + parts.join(' · ') : ''); | |
| } | |
| refresh(); | |
| setInterval(refresh, 30000); | |
| </script> | |
| </body> | |
| </html> | |