From a0ba4f27d277dd6b5339e034a7c9a7511bdb16ba Mon Sep 17 00:00:00 2001 From: Jun Gong Date: Thu, 13 Oct 2022 14:11:09 -0700 Subject: [PATCH] [RLlib] Fix policy restore. Avoid keyward params. (#29227) (#29251) Signed-off-by: Jun Gong --- rllib/policy/policy.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rllib/policy/policy.py b/rllib/policy/policy.py index 214db1fb45ba..592a9bc7ba44 100644 --- a/rllib/policy/policy.py +++ b/rllib/policy/policy.py @@ -289,9 +289,12 @@ def from_state(state: PolicyState) -> "Policy": # Create the new policy. new_policy = pol_spec.policy_class( - observation_space=pol_spec.observation_space, - action_space=pol_spec.action_space, - config=pol_spec.config, + # Note(jungong) : we are intentionally not using keyward arguments here + # because some policies name the observation space parameter obs_space, + # and some others name it observation_space. + pol_spec.observation_space, + pol_spec.action_space, + pol_spec.config, ) # Set the new policy's state (weights, optimizer vars, exploration state,