Skip to content

Commit c346ac8

Browse files
Removes pickle dependency for cfg load and dump (#3709)
# Description We have been supporting both pickle and yaml storing for configuration. However, pickle has some security vulnerabilities and we have been preferring the use of yaml in most cases. Thus, we are removing the pickle utilities for saving and loading configs. For more info on pickle: https://docs.python.org/3/library/pickle.html ## Type of change - Breaking change (existing functionality will not work without user modification) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] 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]> Co-authored-by: Mayank Mittal <[email protected]>
1 parent 9808b6b commit c346ac8

File tree

10 files changed

+20
-70
lines changed

10 files changed

+20
-70
lines changed

scripts/benchmarks/benchmark_rlgames.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
from isaaclab.envs import DirectMARLEnvCfg, DirectRLEnvCfg, ManagerBasedRLEnvCfg
7777
from isaaclab.utils.dict import print_dict
78-
from isaaclab.utils.io import dump_pickle, dump_yaml
78+
from isaaclab.utils.io import dump_yaml
7979

8080
from isaaclab_rl.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper
8181

@@ -168,8 +168,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
168168
# dump the configuration into log-directory
169169
dump_yaml(os.path.join(log_root_path, log_dir, "params", "env.yaml"), env_cfg)
170170
dump_yaml(os.path.join(log_root_path, log_dir, "params", "agent.yaml"), agent_cfg)
171-
dump_pickle(os.path.join(log_root_path, log_dir, "params", "env.pkl"), env_cfg)
172-
dump_pickle(os.path.join(log_root_path, log_dir, "params", "agent.pkl"), agent_cfg)
173171

174172
# read configurations about the agent-training
175173
rl_device = agent_cfg["params"]["config"]["device"]

scripts/benchmarks/benchmark_rsl_rl.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
from isaaclab.envs import DirectMARLEnvCfg, DirectRLEnvCfg, ManagerBasedRLEnvCfg
7777
from isaaclab.utils.dict import print_dict
78-
from isaaclab.utils.io import dump_pickle, dump_yaml
78+
from isaaclab.utils.io import dump_yaml
7979

8080
from isaaclab_rl.rsl_rl import RslRlOnPolicyRunnerCfg, RslRlVecEnvWrapper
8181

@@ -207,8 +207,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
207207
# dump the configuration into log-directory
208208
dump_yaml(os.path.join(log_dir, "params", "env.yaml"), env_cfg)
209209
dump_yaml(os.path.join(log_dir, "params", "agent.yaml"), agent_cfg)
210-
dump_pickle(os.path.join(log_dir, "params", "env.pkl"), env_cfg)
211-
dump_pickle(os.path.join(log_dir, "params", "agent.pkl"), agent_cfg)
212210

213211
benchmark.set_phase("sim_runtime")
214212

scripts/reinforcement_learning/rl_games/train.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
)
8080
from isaaclab.utils.assets import retrieve_file_path
8181
from isaaclab.utils.dict import print_dict
82-
from isaaclab.utils.io import dump_pickle, dump_yaml
82+
from isaaclab.utils.io import dump_yaml
8383

8484
from isaaclab_rl.rl_games import MultiObserver, PbtAlgoObserver, RlGamesGpuEnv, RlGamesVecEnvWrapper
8585

@@ -146,8 +146,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
146146
# dump the configuration into log-directory
147147
dump_yaml(os.path.join(log_root_path, log_dir, "params", "env.yaml"), env_cfg)
148148
dump_yaml(os.path.join(log_root_path, log_dir, "params", "agent.yaml"), agent_cfg)
149-
dump_pickle(os.path.join(log_root_path, log_dir, "params", "env.pkl"), env_cfg)
150-
dump_pickle(os.path.join(log_root_path, log_dir, "params", "agent.pkl"), agent_cfg)
151149

152150
# read configurations about the agent-training
153151
rl_device = agent_cfg["params"]["config"]["device"]

scripts/reinforcement_learning/rsl_rl/train.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
multi_agent_to_single_agent,
8989
)
9090
from isaaclab.utils.dict import print_dict
91-
from isaaclab.utils.io import dump_pickle, dump_yaml
91+
from isaaclab.utils.io import dump_yaml
9292

9393
from isaaclab_rl.rsl_rl import RslRlBaseRunnerCfg, RslRlVecEnvWrapper
9494

@@ -196,8 +196,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
196196
# dump the configuration into log-directory
197197
dump_yaml(os.path.join(log_dir, "params", "env.yaml"), env_cfg)
198198
dump_yaml(os.path.join(log_dir, "params", "agent.yaml"), agent_cfg)
199-
dump_pickle(os.path.join(log_dir, "params", "env.pkl"), env_cfg)
200-
dump_pickle(os.path.join(log_dir, "params", "agent.pkl"), agent_cfg)
201199

202200
# run training
203201
runner.learn(num_learning_iterations=agent_cfg.max_iterations, init_at_random_ep_len=True)

scripts/reinforcement_learning/sb3/train.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def cleanup_pbar(*args):
9191
multi_agent_to_single_agent,
9292
)
9393
from isaaclab.utils.dict import print_dict
94-
from isaaclab.utils.io import dump_pickle, dump_yaml
94+
from isaaclab.utils.io import dump_yaml
9595

9696
from isaaclab_rl.sb3 import Sb3VecEnvWrapper, process_sb3_cfg
9797

@@ -130,8 +130,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
130130
# dump the configuration into log-directory
131131
dump_yaml(os.path.join(log_dir, "params", "env.yaml"), env_cfg)
132132
dump_yaml(os.path.join(log_dir, "params", "agent.yaml"), agent_cfg)
133-
dump_pickle(os.path.join(log_dir, "params", "env.pkl"), env_cfg)
134-
dump_pickle(os.path.join(log_dir, "params", "agent.pkl"), agent_cfg)
135133

136134
# save command used to run the script
137135
command = " ".join(sys.orig_argv)

scripts/reinforcement_learning/skrl/train.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
)
105105
from isaaclab.utils.assets import retrieve_file_path
106106
from isaaclab.utils.dict import print_dict
107-
from isaaclab.utils.io import dump_pickle, dump_yaml
107+
from isaaclab.utils.io import dump_yaml
108108

109109
from isaaclab_rl.skrl import SkrlVecEnvWrapper
110110

@@ -168,8 +168,6 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
168168
# dump the configuration into log-directory
169169
dump_yaml(os.path.join(log_dir, "params", "env.yaml"), env_cfg)
170170
dump_yaml(os.path.join(log_dir, "params", "agent.yaml"), agent_cfg)
171-
dump_pickle(os.path.join(log_dir, "params", "env.pkl"), env_cfg)
172-
dump_pickle(os.path.join(log_dir, "params", "agent.pkl"), agent_cfg)
173171

174172
# get checkpoint path (to resume training)
175173
resume_path = retrieve_file_path(args_cli.checkpoint) if args_cli.checkpoint else None

source/isaaclab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.46.5"
4+
version = "0.47.0"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
Changelog
22
---------
33

4+
0.47.0 (2025-10-14)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Changed
8+
^^^^^^^
9+
10+
* Removed pickle utilities for saving and loading configurations as pickle contains security vulnerabilities in its APIs.
11+
Configurations can continue to be saved and loaded through yaml.
12+
13+
414
0.46.5 (2025-10-14)
515
~~~~~~~~~~~~~~~~~~~
616

17+
Added
18+
^^^^^
19+
720
* Exposed parameter :attr:`~isaaclab.sim.spawners.PhysxCfg.solve_articulation_contact_last`
821
to configure USD attribute ``physxscene:solveArticulationContactLast``. This parameter may
922
help improve solver stability with grippers, which previously required reducing simulation time-steps.

source/isaaclab/isaaclab/utils/io/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
Submodules for files IO operations.
88
"""
99

10-
from .pkl import dump_pickle, load_pickle
1110
from .yaml import dump_yaml, load_yaml

source/isaaclab/isaaclab/utils/io/pkl.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)