Repository navigation
fix(groot_n17): implement latency stats, populate __init__.py, clean up stale docstrings - #132
Merged
LiangSu8899 merged 1 commit intoJul 6, 2026
Conversation
…up stale docstrings - Implement get_latency_stats() across all N1.7 frontends (Thor, RTX, FP8, FP16, SM89). The method was previously a NotImplementedError stub. Now records wall-clock inference latency per call and reports count, mean, std, min, max, p50, p95, and Hz. - Clear latency_records after warmup in every set_prompt() path so get_latency_stats() reflects only user-visible steady-state infer calls, not graph-capture or cuBLAS-priming cost. - Populate groot_n17/__init__.py with public re-exports. Embodiment mappings are imported eagerly (no heavy deps); calibration, M-RoPE table, and pipeline symbols are lazy-loaded via __getattr__ so that `import flash_rt.models.groot_n17` does not pull in torch. - Remove stale Phase 3c comments and docstrings that referenced set_prompt/infer as "still stubbed".
There was a problem hiding this comment.
Pull request overview
Implements steady-state inference latency tracking for the GR00T N1.7 torch frontends and exposes the flash_rt.models.groot_n17 public API via a lightweight __init__.py that keeps heavyweight imports (e.g., torch) lazy.
Changes:
- Added per-
infer()latency recording and aget_latency_stats()implementation on the N1.7 Thor base frontend (inherited by RTX variants). - Cleared
latency_recordsafterset_prompt()warmup across N1.7 frontends so stats reflect steady-state inference only. - Populated
flash_rt.models.groot_n17.__init__with eager re-exports for embodiment mappings and lazy re-exports for calibration / M-RoPE / pipeline symbols.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| flash_rt/models/groot_n17/init.py | Adds eager/lazy public re-exports to avoid importing torch on package import. |
| flash_rt/frontends/torch/groot_n17_thor.py | Adds latency tracking + stats reporting; clears warmup timing; docstring cleanup. |
| flash_rt/frontends/torch/groot_n17_thor_fp8.py | Clears latency_records after warmup in set_prompt(). |
| flash_rt/frontends/torch/groot_n17_rtx_fp8.py | Clears latency_records after warmup in set_prompt(). |
| flash_rt/frontends/torch/groot_n17_rtx_sm89.py | Clears latency_records after warmup in set_prompt(). |
| flash_rt/frontends/torch/groot_n17_rtx_fp16.py | Adds timing/recording for overridden infer(); clears warmup timing. |
| flash_rt/frontends/torch/groot_n17_rtx_sm89_fp16.py | Adds timing/recording for overridden infer(); clears warmup timing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self._k_actions.copy_(torch.randn( | ||
| action_horizon, action_dim, dtype=torch.bfloat16, device=device)) | ||
| self._k_dit_graph.replay() | ||
| torch.cuda.synchronize() |
| # ── Euler step ────────────────────────────────────────────── | ||
| actions = actions + (dt * velocity).to(actions.dtype) | ||
|
|
||
| torch.cuda.synchronize() |
| velocity = self._run_action_decode(h_out[:, -action_horizon:]) | ||
| actions = actions + (dt * velocity).to(actions.dtype) | ||
|
|
||
| torch.cuda.synchronize() |
| velocity = self._run_action_decode(h_out[:, -action_horizon:]) | ||
| actions = actions + (dt * velocity).to(actions.dtype) | ||
|
|
||
| torch.cuda.synchronize() |
LiangSu8899
approved these changes
Jul 5, 2026
hypertseng
added a commit
to hypertseng/FlashRT
that referenced
this pull request
Jul 10, 2026
Include: - Qwen3 prefill fast path optimization (flashrt-project#134) - SM89 Qwen3-VL FP8 decode-path optimization (flashrt-project#139) - VLASH async runner (flashrt-project#138) - RTC temporal fusion runtime (flashrt-project#137) - GRoot N17 latency stats and fixes (flashrt-project#132) - Thor fp16 routing through Thor producer (flashrt-project#133) - Qwen3-VL improvements and fixes Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement
get_latency_stats()across all N1.7 frontends (Thor, RTX, FP8, FP16, SM89). Previously aNotImplementedErrorstub — now records wall-clock inference latency perinfer()call and reports count / mean / std / min / max / p50 / p95 / Hz, matching the Pi0.5 and Groot N1.6 API contract.Clear
latency_recordsafter warmup in everyset_prompt()path soget_latency_stats()reflects only user-visible steady-state inference, not graph-capture or cuBLAS-priming cost.Populate
groot_n17/__init__.pywith public re-exports. Embodiment mappings (EMBODIMENT_TAG_TO_INDEX,EMBODIMENT_NUM_VIEWS) are imported eagerly (pure dicts, no heavy deps). Calibration, M-RoPE table, and pipeline symbols are lazy-loaded via__getattr__so thatimport flash_rt.models.groot_n17does not pull in torch.Remove stale Phase 3c comments and docstrings that referenced
set_prompt/inferas "still stubbed".Files changed
groot_n17_thor.pylatency_recordsinit, timing ininfer()(both graph + eager paths),get_latency_stats()impl, warmup clear, docstring cleanupgroot_n17_rtx_fp16.pyinfer(), warmup cleargroot_n17_rtx_sm89_fp16.pyinfer(), warmup cleargroot_n17_rtx_fp8.pygroot_n17_rtx_sm89.pygroot_n17_thor_fp8.pygroot_n17/__init__.pyValidation
No GPU / checkpoint required for this change — all edits are Python-level API plumbing with no change to runtime kernels, calibration, or graph capture behavior.
Test plan
import flash_rt.models.groot_n17does not import torchcalibrate_pipeline_amax,RopeConfig,dit_forwardget_latency_stats()source contains noNotImplementedErrorinfer()in Thor base and both FP16 subclasses containstime.perf_counter+latency_records.appendtest_groot_n17_e2e.py— confirmget_latency_stats()returns non-empty dict after inferencelatency_recordsis empty immediately afterset_prompt()(warmup cleared)