Repository navigation
Rename modifiers and unify tensor processor APIs #8693
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
mataylor-nvidia
wants to merge
22
commits into
isaac-sim:main
Choose a base branch
from
mataylor-nvidia:feat/tensor-processors
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.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e7580cd
Rename modifiers to tensor processors and add dictionary processing
mataylor-nvidia 4d3c5e8
Centralize modifier deprecation compatibility
mataylor-nvidia 93aa169
Replace modifier aliases with migration errors
mataylor-nvidia 51ecf64
Remove the legacy observation modifiers field
mataylor-nvidia 72f3f19
Integrate dictionary processors with observation groups
mataylor-nvidia 32ad9f0
Apply dictionary processors to individual observation terms
mataylor-nvidia 29edf1a
Finish environment teardown after processor cleanup errors
mataylor-nvidia b794e75
Fix observation type annotations for Sphinx imports
mataylor-nvidia 0ae9669
Preserve dictionary observation schemas after validation failures
mataylor-nvidia 12d30f4
Simplify dictionary observation Gym spaces
mataylor-nvidia 1a73657
Allow optional output parameters on dictionary observation terms
mataylor-nvidia db9a1f9
Keep observation terms tensor-valued
mataylor-nvidia 236c3ae
Add dictionary tensor processor configuration and interface
mataylor-nvidia 9df69eb
Resolve nested dictionary processor parameters
mataylor-nvidia d44e2ba
Use tensor processor terminology consistently
mataylor-nvidia 3ae0408
Merge branch 'main' into feat/tensor-processors
ooctipus 9127465
Preserve modifier imports with deprecation warnings
mataylor-nvidia e5f4c0a
Restore None return type for Warp observation terms
mataylor-nvidia b924f27
Merge branch 'main' into feat/tensor-processors
mataylor-nvidia 383f324
Migrate LEAPP export fixture to tensor processors
mataylor-nvidia 85a3465
Unify tensor and structured data processors
mataylor-nvidia ee9d78d
Address tensor processor review feedback
mataylor-nvidia 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
Some comments aren't visible on the classic Files Changed page.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| * Extended ``TensorProcessor`` and ``TensorProcessorCfg`` to support tensors, ``ProxyArray`` values, | ||
| and nested lists, tuples, and dictionaries through the shared ``TensorProcessorData`` type. | ||
| Added optional named input/output metadata and lifecycle hooks while preserving single-tensor | ||
| observation processing. Added manager resolution of nested scene entities and manager terms | ||
| in processor parameters. |
3 changes: 3 additions & 0 deletions
3
source/isaaclab/changelog.d/dict-tensor-processors.deprecated.rst
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| * Deprecated ``ObservationTermCfg.modifiers`` in favor of ``ObservationTermCfg.tensor_processors``. | ||
| Retained the legacy field with a targeted warning and forwarding during manager initialization. | ||
| Setting both fields now raises ``ValueError`` to prevent silently overriding either pipeline. |
Empty file.
3 changes: 3 additions & 0 deletions
3
source/isaaclab/changelog.d/modifier-import-shim.deprecated.rst
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| * Deprecated ``isaaclab.utils.modifiers``, ``ModifierBase``, and ``ModifierCfg`` in favor of | ||
| ``isaaclab.utils.tensor_processors``, ``TensorProcessor``, and ``TensorProcessorCfg``. Preserved | ||
| legacy imports and serialized callable paths with an import-time deprecation warning. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,15 +7,16 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| import warnings | ||
| from collections.abc import Callable | ||
| from dataclasses import MISSING | ||
| from typing import TYPE_CHECKING, Any, Literal | ||
|
|
||
| import torch | ||
|
|
||
| from ..utils import configclass | ||
| from ..utils.modifiers import ModifierCfg | ||
| from ..utils.noise import NoiseCfg, NoiseModelCfg | ||
| from ..utils.tensor_processors import TensorProcessorCfg | ||
| from .scene_entity_cfg import SceneEntityCfg | ||
|
|
||
| if TYPE_CHECKING: | ||
|
|
@@ -162,20 +163,23 @@ class ObservationTermCfg(ManagerTermBaseCfg): | |
| """The function or :class:`ManagerTermBase` subclass to be called. | ||
|
|
||
| The manager instantiates class-based terms before calling them. | ||
| The function or the class's ``__call__`` method should take the environment object and any other parameters | ||
| as input and return the observation signal as torch float tensors of | ||
| shape (num_envs, obs_term_dim). | ||
| With the standard observation manager, the function or the class's ``__call__`` method takes the | ||
| environment object and any other parameters as input and returns the observation signal as a | ||
| torch tensor of shape (num_envs, obs_term_dim). | ||
|
|
||
| With the experimental Warp observation manager, it also takes a pre-allocated output buffer as | ||
| its second argument, writes the observations into that buffer, and returns None. | ||
| """ | ||
|
|
||
| modifiers: list[ModifierCfg] | None = None | ||
| """The list of data modifiers to apply to the observation in order. Defaults to None, | ||
| tensor_processors: list[TensorProcessorCfg] | None = None | ||
| """The list of tensor processors to apply to the observation in order. Defaults to None, | ||
| in which case no modifications will be applied. | ||
|
|
||
| Modifiers are applied in the order they are specified in the list. They can be stateless | ||
| Processors are applied in the order they are specified in the list. They can be stateless | ||
| or stateful, and can be used to apply transformations to the observation data. For example, | ||
| a modifier can be used to normalize the observation data or to apply a rolling average. | ||
| a processor can be used to normalize the observation data or to apply a rolling average. | ||
|
|
||
| For more information on modifiers, see the :class:`~isaaclab.utils.modifiers.ModifierCfg` class. | ||
| For more information, see :class:`~isaaclab.utils.tensor_processors.TensorProcessorCfg`. | ||
| """ | ||
|
|
||
| noise: NoiseCfg | NoiseModelCfg | None = None | ||
|
|
@@ -206,7 +210,7 @@ class ObservationTermCfg(ManagerTermBaseCfg): | |
| delay_max_lag: int = 0 | ||
| """Maximum observation delay, counted in recorded samples. Zero disables delay. | ||
|
|
||
| Set both lag bounds equal for a constant delay. Delay is applied after modifiers, noise, clipping, and | ||
| Set both lag bounds equal for a constant delay. Delay is applied after tensor processors, noise, clipping, and | ||
| scaling, before observation history. Until enough samples have been recorded, the oldest available | ||
| sample is returned. After reset, no data from the previous episode is returned. | ||
| """ | ||
|
|
@@ -233,6 +237,14 @@ class ObservationTermCfg(ManagerTermBaseCfg): | |
| """Whether or not the observation manager should flatten history-based observation terms to a 2-D (N, D) tensor. | ||
| Defaults to True.""" | ||
|
|
||
| modifiers: list[TensorProcessorCfg] | None = None | ||
|
Collaborator
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. The old cfg also need deprecation shim? |
||
| """Deprecated alias for :attr:`tensor_processors`, to be removed in a future release. | ||
|
|
||
| During manager initialization, a non-None value emits a :class:`FutureWarning`, is forwarded | ||
| to :attr:`tensor_processors`, and is cleared from this field. Set only one of the two fields; | ||
| providing both raises :class:`ValueError`, even for empty lists. | ||
| """ | ||
|
|
||
| def validate_config(self): | ||
| """Validate observation delay bounds.""" | ||
| if type(self.delay_min_lag) is not int or type(self.delay_max_lag) is not int: | ||
|
|
@@ -242,6 +254,21 @@ def validate_config(self): | |
| if not 0.0 <= self.delay_hold_prob <= 1.0: | ||
| raise ValueError("delay_hold_prob must be in [0, 1].") | ||
|
|
||
| def _migrate_modifiers(self) -> None: | ||
| """Normalize the deprecated field after user edits and before manager preparation.""" | ||
| if self.modifiers is None: | ||
| return | ||
| if self.tensor_processors is not None: | ||
| raise ValueError("Set only one of 'modifiers' and 'tensor_processors'.") | ||
| warnings.warn( | ||
| "ObservationTermCfg.modifiers is deprecated and will be removed in a future release." | ||
| " Use ObservationTermCfg.tensor_processors instead.", | ||
| FutureWarning, | ||
| stacklevel=5, | ||
| ) | ||
| self.tensor_processors = self.modifiers | ||
| self.modifiers = None | ||
|
|
||
|
|
||
| @configclass | ||
| class ObservationGroupCfg: | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.