-
Notifications
You must be signed in to change notification settings - Fork 3.2k
RTC adjustments. Bug fix & Alex Soare optimization #2499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
helper2424
wants to merge
18
commits into
huggingface:main
Choose a base branch
from
helper2424:user/helper2424/21-11-2025_rtc_smooth_optimization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+888
−51
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8c85667
Add Alex Soare RTC optimization
helper2424 a1b0183
Add variance cliping factor
helper2424 d9314da
Fixes for RTC
helper2424 f42250b
fixup! Fixes for RTC
helper2424 9c3c810
fixup! fixup! Fixes for RTC
helper2424 19717fb
Fix eval_dataset
helper2424 b966ad3
Fixup
helper2424 6d836a0
Fix tests
helper2424 798748c
Extend modeling RTC tests
helper2424 0018e61
Fix tests
helper2424 25081f9
Remove back the logic for num_flow_mathcing steps
helper2424 cb6c862
Update tests
helper2424 c38bfe1
Fix tests
helper2424 0866355
Fix tests
helper2424 a642ec8
Fix docs
helper2424 052b6d1
Add an ability to make a dataset shift
helper2424 527f9f5
Increase default execution horizon in eval_with_robot
helper2424 8eb10cd
Update
helper2424 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,6 @@ policy_cfg = PI0Config() | |
| policy_cfg.rtc_config = RTCConfig( | ||
| enabled=True, | ||
| execution_horizon=10, # How many steps to blend with previous chunk | ||
| max_guidance_weight=10.0, # How strongly to enforce consistency | ||
| prefix_attention_schedule=RTCAttentionSchedule.EXP, # Exponential blend | ||
| ) | ||
|
|
||
|
|
@@ -101,7 +100,10 @@ Typical values: 8-12 steps | |
| RTCConfig(execution_horizon=10) | ||
| ``` | ||
|
|
||
| **`max_guidance_weight`**: How strongly to enforce consistency with the previous chunk. This is a hyperparameter that can be tuned to balance the smoothness of the transitions and the reactivity of the policy. For 10 steps flow matching (SmolVLA, Pi0, Pi0.5), a value of 10.0 is a optimal value. | ||
| **`max_guidance_weight`**: How strongly to enforce consistency with the previous chunk. This is a hyperparameter that can be tuned to balance the smoothness of the transitions and the reactivity of the policy. | ||
|
|
||
| If `max_guidance_weight` is not set, the number of flow matching steps will be used as max guidance weight. | ||
| Check the following paper - https://alexander-soare.github.io/robotics/2025/08/05/smooth-as-butter-robot-policies.html | ||
|
|
||
| **`prefix_attention_schedule`**: How to weight consistency across the overlap region. | ||
|
|
||
|
|
@@ -112,6 +114,14 @@ RTCConfig(execution_horizon=10) | |
|
|
||
| **`inference_delay`**: How many timesteps of inference latency your system has. This is passed to `predict_action_chunk()` rather than the config, since it may vary at runtime. | ||
|
|
||
| **`sigma_d`**: The variance of the prior distribution. This is a hyperparameter that can be tuned to balance the smoothness of the transitions and the reactivity of the policy. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: sigma is not "variance", but "standard deviation" rather. |
||
|
|
||
| Typical values: 0.1-1.0 | ||
|
|
||
| By default, `sigma_d` is set to 1.0. So it's following the original RTC paper. But you can tune it to your needs, by reducing it to get more reactivity and by increasing it to get more smoothness. | ||
|
|
||
| Check the following paper - https://alexander-soare.github.io/robotics/2025/08/05/smooth-as-butter-robot-policies.html | ||
|
|
||
| ## Testing RTC Offline | ||
|
|
||
| Before running on a real robot, test RTC with dataset samples to visualize how it works: | ||
|
|
@@ -121,7 +131,6 @@ python examples/rtc/eval_dataset.py \ | |
| --policy.path=lerobot/pi0_libero_finetuned \ | ||
| --dataset.repo_id=HuggingFaceVLA/libero \ | ||
| --rtc.execution_horizon=10 \ | ||
| --rtc.max_guidance_weight=10.0 \ | ||
| --device=cuda | ||
| ``` | ||
|
|
||
|
|
||
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clipping parameter, no the actual guidance weight. You might modify the sentence to say include something like "a clipping parameter on the computed guidance weight. Ensures stability."