Skip to content

Modifies update_class_from_dict() to wholesale replace flat Iterables - #2511

Merged
kellyguo11 merged 15 commits into
isaac-sim:mainfrom
ozhanozen:fix/configclass-update
Jun 27, 2025
Merged

kellyguo11 merged 15 commits into
isaac-sim:mainfrom
ozhanozen:fix/configclass-update

Conversation

@ozhanozen

Copy link
Copy Markdown
Contributor

Description

Currently, update_class_from_dict() does not allow updating the configclass Iterable elements with Hydra, when the provided Iterable length differs from the default value. Such a feature is nevertheless needed when changing the network layer depth on the go, e.g., while using learning libraries that utilize configclass (see #2456 for details).

This PR modifies update_class_from_dict() such that if an element is a flat Iterable (e.g., flat list), it is replaced wholesale, without checking the lengths. Moreover, the PR modifies the robustness of the function against a few edge cases that might break the execution, and adds comments to make it easier to follow the logic flow.

Note: I left the changelog entry as [Unreleased] until a green light is given.

Fixes #2456.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@Mayankm96

Copy link
Copy Markdown
Contributor

Agreed. Faced a similar issue. Can you also add a unit test for this change to make sure we maintain the desired behavior?

Also wondering: flat Iterable (e.g., flat list), it is replaced wholesale, without checking the lengths -- I don't think there are situations where we don't want to do this change. Initially, it must have been to keep it safe while updating lists/tuples (for instance, when specifying ranges for parameters) and not let users write wrong length of arrays. But I am also in for just simplifying the whole thing and throwing a warning instead of a error while updating a list/tuple of different lengths. This should simplify the code too.

@ozhanozen

Copy link
Copy Markdown
Contributor Author

Agreed. Faced a similar issue. Can you also add a unit test for this change to make sure we maintain the desired behavior?

I have added the unit test case (i.e., test_config_update_different_iterable_lengths) inside test_configclass.py.

Also wondering: flat Iterable (e.g., flat list), it is replaced wholesale, without checking the lengths -- I don't think there are situations where we don't want to do this change. Initially, it must have been to keep it safe while updating lists/tuples (for instance, when specifying ranges for parameters) and not let users write wrong length of arrays. But I am also in for just simplifying the whole thing and throwing a warning instead of a error while updating a list/tuple of different lengths. This should simplify the code too.

Do you mean we should replace the Iterable elements wholesale, wherever they are flat Iterable or not?

This creates an issue when the list has a subdictionary (e.g., main_dict -> list -> sub_dict). Actually, there is a specific test case for such a situation (test_config_update_nested_dict inside test_configclass.py), which fails if the list containing the sub_dict is replaced. I thought maybe this is an edge-case which could be removed, but then I had associated errors while running trainings, so I guess it has to be covered.

Let me know if you meant something else or you have other feedback.

@ozhanozen

Copy link
Copy Markdown
Contributor Author

Hi @Mayankm96, just a gentle ping on this PR whenever you have a moment, thanks!

@kellyguo11
kellyguo11 merged commit 394a162 into isaac-sim:main Jun 27, 2025
@ozhanozen
ozhanozen deleted the fix/configclass-update branch June 27, 2025 15:06
harry-wf-cheung pushed a commit to harry-wf-cheung/IsaacLab-Harry that referenced this pull request Jul 30, 2025
…es (isaac-sim#2511)

# Description

Currently, `update_class_from_dict()` does not allow updating the
configclass Iterable elements with Hydra, when the provided Iterable
length differs from the default value. Such a feature is nevertheless
needed when changing the network layer depth on the go, e.g., while
using learning libraries that utilize configclass (see isaac-sim#2456 for
details).

This PR modifies `update_class_from_dict()` such that if an element is a
flat Iterable (e.g., flat list), it is replaced wholesale, without
checking the lengths. Moreover, the PR modifies the robustness of the
function against a few edge cases that might break the execution, and
adds comments to make it easier to follow the logic flow.

Note: I left the changelog entry as `[Unreleased]` until a green light
is given.

Fixes isaac-sim#2456.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
LJones-alt pushed a commit to LJones-alt/IsaacLab-Laura that referenced this pull request Jul 1, 2026
…es (isaac-sim#2511)

# Description

Currently, `update_class_from_dict()` does not allow updating the
configclass Iterable elements with Hydra, when the provided Iterable
length differs from the default value. Such a feature is nevertheless
needed when changing the network layer depth on the go, e.g., while
using learning libraries that utilize configclass (see isaac-sim#2456 for
details).

This PR modifies `update_class_from_dict()` such that if an element is a
flat Iterable (e.g., flat list), it is replaced wholesale, without
checking the lengths. Moreover, the PR modifies the robustness of the
function against a few edge cases that might break the execution, and
adds comments to make it easier to follow the logic flow.

Note: I left the changelog entry as `[Unreleased]` until a green light
is given.

Fixes isaac-sim#2456.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
csj-275 pushed a commit to csj-275/IsaacLab that referenced this pull request Jul 8, 2026
…es (isaac-sim#2511)

# Description

Currently, `update_class_from_dict()` does not allow updating the
configclass Iterable elements with Hydra, when the provided Iterable
length differs from the default value. Such a feature is nevertheless
needed when changing the network layer depth on the go, e.g., while
using learning libraries that utilize configclass (see isaac-sim#2456 for
details).

This PR modifies `update_class_from_dict()` such that if an element is a
flat Iterable (e.g., flat list), it is replaced wholesale, without
checking the lengths. Moreover, the PR modifies the robustness of the
function against a few edge cases that might break the execution, and
adds comments to make it easier to follow the logic flow.

Note: I left the changelog entry as `[Unreleased]` until a green light
is given.

Fixes isaac-sim#2456.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Cannot modify network architecture with hydra if agent config is a configclass

3 participants