Repository navigation
Add GPU differentiable IK layers and shared neural networks - #806
Merged
Merged
Conversation
[Medium impact] The PR appears safe to merge with the documented import migration. SummaryAdds standalone Torch kinematics and fixed-step differentiable IK, alongside shared neural-network components.
|
6 tasks done
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
Add GPU-batched differentiable kinematics and fixed-step IK for training and task-parameter optimization. Target poses and initial joint states retain first-order gradients through FK, the Jacobian and every DLS update. Failed solves return their final iterate and continuous residuals.
The ownership boundaries are:
compute/kinematics: pure Torch DLS, pose residuals, copied PK geometry, configuration and result types.learning/layers:KinematicsLayerandDifferentiableIKLayer, with float32/float64, device migration and fixed-geometry checkpoint validation. Forward-only inference uses the same layer undertorch.no_grad().learning/models: only general components —MLP,EmpiricalNormalizerandbuild_mlp_from_cfg. Shared networks, feature normalization and MLP construction do not import RL, TensorDict or simulation.learning/rl/policies: RL-specificPolicy,ActorOnly,ActorCritic, policy registration, observation-group resolution and policy construction. RL runtime, collectors, algorithms and trainers consume these interfaces and the shared components.Generic components import from
embodichain.learning.models; RL abstractions import fromembodichain.learning.rl.policies. There are no compatibility aliases between these namespaces. External imports must uselearning.modelsfor generic components andlearning.rl.policiesfor RL policies. The previouslearning.rl.modelspackage is removed. RL policy behavior and state-dict structure are preserved.Assigned checkpoint loads synchronize fixed PK geometry to the loaded tensor buffers through a child-module post-load hook. This also works when an enclosing network loads its state dict. Synchronization is confined to checkpoint loading; FK and IK calls retain their existing computation path.
Callers own root-frame conversion, TCP, physical limits and optimization. Hard-limit projection and the rotation branch cut have documented gradient boundaries. Robot defaults and registered runtime solvers are unchanged. The unified benchmark measures differentiable forward/backward and component costs. The runnable use case is the interactive grasp-yaw demo in #808; the earlier synthetic training example is removed.
API references, learning/RL guides, context ownership and architecture evidence reflect these boundaries. Dependencies: existing project packages; no new requirements. No linked issue.
Stack
mainType of change
learning.models; RL policy imports move tolearning.rl.policies.Validation
All current validation uses conda py311:
python -m black .;git diff --check.The installed DexSim generated exports lack cable-render kernel exports. The 49 runtime regressions use an existing process-local overlay exposing the actual cable kernels from the sibling DexSim sources; no dependency sources or test stubs are changed. Standalone checks and the grasp-yaw demo run without this overlay.
Context review: revise learning-layers and RL ownership, retain policy registration in RL, synchronize model API/architecture references, and document assigned-checkpoint geometry migration. The checkpoint fix preserves architecture topology and public exports; its existing architecture snapshot remains valid.
Screenshots
Interactive preview and demo artifacts are in #808.
Checklist