feat: redesign FastSAC console rich panel (#15) - #21
Conversation
206416d to
0e89245
Compare
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness issues in the new console interaction and async learn_ms_total computation that can misreport behavior and/or leave terminal state inconsistent on exceptions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR redesigns the FastSAC Rich live training panel in motrix_rl.console to improve information hierarchy, add an overview vs. timing-detail view, and surface “system health” (CPU/GPU + RAM/VRAM) with lower refresh overhead by sampling NVIDIA GPU metrics via NVML.
Changes:
- Reworked Rich panel renderer (summary cards + compact metric grids) and added a timing detail view toggled via
1/2keys on POSIX TTYs. - Added host memory + GPU utilization/VRAM samplers and integrated them into sync/async FastSAC loops; checkpoint saves now surface in-panel.
- Introduced runtime dependency
nvidia-ml-pyand expanded tests/attribution accordingly.
File summaries
| File | Description |
|---|---|
| uv.lock | Locks nvidia-ml-py and records its distribution artifacts. |
| THIRD_PARTY_NOTICES.md | Adds nvidia-ml-py to runtime dependency attribution. |
| motrix_rl/pyproject.toml | Declares new runtime dependency nvidia-ml-py>=13.610.43. |
| motrix_rl/src/motrix_rl/system_metrics.py | Adds MemoryUsage + Linux/Windows RAM sampling and NVML-based GPU samplers. |
| motrix_rl/src/motrix_rl/console.py | Implements new Rich panel layout, compact metric formatting, and POSIX-only key input handling. |
| motrix_rl/src/motrix_rl/fastsac/sync/train.py | Wires system samplers + checkpoint path into sync training panel stats/title. |
| motrix_rl/src/motrix_rl/fastsac/async_impl/worker.py | Updates async learner timing semantics/tree and wires system samplers + checkpoint path + renamed TB scalar. |
| motrix_rl/src/motrix_rl/fastsac/async_impl/train.py | Passes env_name into learner process for panel titles. |
| motrix_rl/tests/test_system_metrics.py | Adds unit tests for NVML aggregation/error handling and Linux/Windows memory sampling. |
| motrix_rl/tests/test_console.py | Adds rendering/layout/timing-view tests and POSIX-TTY degradation coverage. |
Review details
- Files reviewed: 9/10 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2a041f3 to
7c28f36
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The redesign is well-covered by targeted tests and the functional changes appear correct, with only minor maintainability follow-ups noted in review comments.
Review details
Suppressed comments (1)
motrix_rl/src/motrix_rl/console.py:505
- The nested si() helper inside render_training_panel() is unused. Keeping unused helpers in the hot rendering path makes the function harder to read and suggests incomplete refactors.
def si(number: float) -> str:
for unit in ("", "k", "M"):
if abs(number) < 1000:
return f"{number:.0f}{unit}" if not unit else f"{number:.1f}{unit}"
number /= 1000.0
return f"{number:.1f}G"
- Files reviewed: 10/11 changed files
- Comments generated: 2
- Review effort level: Lite
7c28f36 to
8acd012
Compare
|
All review feedback is addressed in 8acd012 (branch squashed back to a single commit): Round 1
Round 2
Validation: |
8acd012 to
c8c348c
Compare
c8c348c to
55af7ff
Compare


Target branch
Branch on
Motphys/MotrixLabtargetingmain(same-repo PR, no fork involved).Summary
Redesigns the FastSAC Rich training panel (#15):
bar, Episode stats, Throughput, Timing, System health), followed by
Training / Rewards / Environment metric cards with terminal-width-adaptive
compact grids (2–4 columns).
1/2keys switch between Overview and a Timing view thatrenders per-process timing trees with MEAN/SHARE columns, plus timing detail
and diagnostics. Keyboard input uses a cbreak
_InputLivesubclass and isPOSIX-only; other platforms fall back to a plain
Live.are sampled in-process via NVML (
nvidia-ml-py) instead of spawningnvidia-smiper refresh (steady-state cost drops from ~2 spawns × tens of msto ~5 µs); host memory sampling supports Linux
/proc/meminfoand WindowsGlobalMemoryStatusEx.instead of interrupting the live display.
two-digit scientific notation, and label width is derived from the exact Rich
column arithmetic, so metric rows stay on one line from narrow to wide
terminals.
learner's
learn_mssemantics (now the per-update total of drain + waits +update stages; TensorBoard scalar renamed
perf/learn_ms_per_update→perf/learn_ms_total).Issue
Fixes #15
Validation
uv run pytest -q(883 passed)prek run --all-filesnvidia-ml-pyadded tothe runtime dependency list in
THIRD_PARTY_NOTICES.mdincluded in the commits, logs, or screenshots.
Additional manual validation: panel rendering smoke-tested at 80–300 terminal
columns in both views with no markup leakage; Windows degradation verified by
importing with
termios/ttyhidden; NVML sampling benchmarked on a live GPU.Compatibility and migration
nvidia-ml-py>=13.610.43onmotrix_rl(pure Pythonctypes bindings, locked in
uv.lock). GPU panel fields shown/awhen noNVIDIA driver is present.
motrix_rl.consoleno longer importstermios/ttyunconditionally, so itis importable on Windows; keyboard view switching remains POSIX-only.
TrainingPanelStatsgained optional fields (gpu_utilization_percent,memory_usage,gpu_memory_usage,checkpoint_path); existing consumersare unaffected.
run_learner_processgained anenv_nameparameter; panel titlesnow include the environment name.
Safety and release impact
nvidia-smisubprocess spawns per panel refreshfrom the learner step loop (previously ~16 ms each on reference hardware,
worse under load); NVML sampling is microseconds.
single commit on
main.