Repository navigation
Add a learned grasp-yaw demo with differentiable IK - #808
Merged
Merged
Conversation
[Low impact] The PR appears safe to merge, with a non-blocking gap in saved online-search failure records.
|
7 tasks done
Base automatically changed from
codex/differentiable-ik-learning-layers
to
main
October 18, 2026 11:42
yuecideng
force-pushed
the
codex/free-yaw-ik-demo
branch
from
October 18, 2026 15:16
b8f28e3 to
594d202
Compare
yuecideng
force-pushed
the
codex/free-yaw-ik-demo
branch
from
October 18, 2026 15:32
85d0455 to
673cbd9
Compare
| online_angle, online_found = optimize_task_angles( | ||
| inner, data, cfg.reference_updates, cfg.chunk_size | ||
| ) | ||
| online = evaluate_angles(check, data, online_angle, cfg.chunk_size) |
There was a problem hiding this comment.
run saves online_found only for the first eight cases per split in replay.npz. The remaining flags are lost because paired_results.npz contains only the final 64-step results. A heading fallback can pass that longer solve, so final success cannot reveal that the online search failed. Save online_found for every query alongside the paired results.
Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/learning/differentiable_ik/learn_grasp_yaw.py
Line: 739
Comment:
**Search failure flags are lost**
`run` saves `online_found` only for the first eight cases per split in `replay.npz`. The remaining flags are lost because `paired_results.npz` contains only the final 64-step results. A heading fallback can pass that longer solve, so final success cannot reveal that the online search failed. Save `online_found` for every query alongside the paired results.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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.
Description
Train a conditional grasp-yaw predictor from downstream joint-space cost through
DifferentiableIKLayer. A frozen network then chooses an angle for new current-joint/target-position pairs using one network evaluation and one fixed-step IK solve. Grasp position and downward approach remain fixed.The example uses the learning layers already merged in #806. It adds a training/evaluation runner and a frozen-model Viser viewer. Numerical angle optimization and grid search are integrated reference baselines. Generated results, checkpoints, screenshots and validation artifacts are kept out of Git; the PR branch has been rebuilt without their historical versions. No production API changes.
The comparison includes current heading, one learned absolute angle, an IK-trained MLP, a teacher-supervised MLP with the same initialization/minibatches, per-query Adam optimization, and a 129-angle grid. The IK-trained method does not consume teacher labels; label generation is charged separately to the supervised comparison.
Evaluation
Three training seeds; 1,024 training tasks; 128 independent validation tasks; 128 cases in each held-out split. Only validation task loss selects checkpoints. Training uses 24 IK steps and all final methods use the same 64-step budget, current-joint seed, and strict physical-limit/pose checks.
Average cost gaps to the sampled grid are below 0.2% for each split/seed. The teacher-supervised network performs similarly; this does not establish superiority of end-to-end training. Per-target failures and paired-valid counts are retained in the full run artifacts.
On the RTX PRO 5000 72GB, each IK-trained model took about 28–31 seconds. Supervised fitting took about 0.5 seconds plus 30 seconds to generate training labels (shared across its runs). At batch 64, complete learned inference measured 86.9 ms, fully batched grid search 86.2 ms, and per-query gradient optimization 7.09 s. The grid uses a separate 16,384-candidate inference chunk to avoid an artificial small-batch penalty. The learned method does not outperform the one-dimensional grid in latency here. Incremental Torch peak memory was about 1.03 MB versus 37.74 MB, respectively.
These are local kinematic tasks. Costs measure joint endpoint displacement; collision, contact, dynamics, executable trajectories, and global optimality are not validated.
Preview and usage
The viewer supports held-out/model selection, current-posture inspection, automatic frozen inference after moving the cylinder, and optional online reference search. Training weights never change in the viewer. Stale work is discarded after inputs change.
To reproduce training and evaluation:
The README describes data distributions, baselines, CPU smoke commands, timing scope and artifacts. All reports, plots, checkpoints, replay data and validation results are generated locally under the selected output directory. Run training before opening the viewer; no pretrained bundle is committed.
Type of change
Validation
All checks use conda
py311:black .), compile checks,git diff --check, API coverage (2628/2628) and context checks passed. Example validation is executable; no tutorial-importing pytest modules were added.Checklist
#806 is merged. This branch is rebuilt directly on
main, so its diff contains only the example and related documentation/artifacts.Artifact cleanup: the final PR contains eight source/configuration/documentation files and no new test files or generated artifacts. Its branch history is a single commit on the existing main baseline.