skrl icon indicating copy to clipboard operation
skrl copied to clipboard

DDPG: KeyError ' initial_scale'

Open pietrodardano opened this issue 8 months ago • 0 comments

Description

Hello, i'm trying to train a DDPG agent in Isaaclab but everytime it logs:

File "/home/user/miniconda3/envs/isaacenv/lib/python3.10/site-packages/skrl/agents/torch/ddpg/ddpg.py", line 157, in __init__
    self._exploration_initial_scale = self.cfg["exploration"]["initial_scale"]
KeyError: 'initial_scale'

the value that i am using is the one from the DDPG_DEFAULT_CONFIG thus: 1.0

( The agent is created here: my_ddpg_agent )

-- EDIT:

✅ Solved by modifying lines 159 to 161 of ddpg.py adding .get() method.

self._exploration_initial_scale = self.cfg["exploration"].get("initial_scale", 1.0)
self._exploration_final_scale = self.cfg["exploration"].get("final_scale", 1e-3)
self._exploration_timesteps = self.cfg["exploration"].get("timesteps", None)

1.0, 1e-3 and None are the DDPG_DEFAULT_CONFIG values

I still don't know why it previously generated that error, from the code side it appeared correct also to me

What skrl version are you using?

1.4.3

What ML framework/library version are you using?

PyTorch 2.5.1+cu118

Additional system information

Python 3.10.16, Ubuntu 20.04, Isaaclab v2.0.2, IsaacSim 4.5.0-rc.36

pietrodardano avatar Apr 14 '25 10:04 pietrodardano