PPOConfig + custom_model = no PPO at all?

  • High: It blocks me to complete my task.

Hi, I met some confusing problem.
PPOConfig in as a algorithm that inherits from PGConfig and that inherits from AlgorithmConfig.
Algorithm config has option to set a model to a custom one. So my question is what gives me building code and ray.rllib.algorithms.ppo.ppo.PPOConfig like, if at the end of the implementation of custom model (TorchModelV2, torch.nn.Module) i have to implement value fun, loss fun, etc etc. and at the end i assume its my implementation of ppo, instead of rllib.

config = (PPOConfig()
          .rl_module(_enable_rl_module_api = False)
          .environment(WeatherEnv,
          env_config={
                  "vision_range": 10,
                })
            .framework("torch")
            .rollouts(num_rollout_workers=0)
            .training(
                _enable_learner_api = False,          
                model = {
                
                "custom_model" : "WeatherModel",
                "custom_model_config" : {
                    #"obs_space" : gym.Space(shape=(10,24)),
                    #"action_space" : Env_env.action_space,
                    #"num_outputs" : num_layers,
                    #"model_config" : {},
                    "device" : "cpu", # potetialy to delete
                    "hidden_size" : hidden_size,
                    "input_size" : input_size,
                    "num_layers" : num_layers,
                    "dropout_rate" : dropout_rate
                },
              }
            )
          )
algo = ppo.PPO(config=config)

Also I dont know what Im doing wrong but

"obs_space" : gym.Space(shape=(10,24))

gives me:

ray/rllib/models/catalog.py:610
--> 610     instance = model_cls(

    618 except TypeError as e:
    620     if "__init__() got an unexpected " in e.args[0]:

TypeError: WeatherModel.__init__() got multiple values for argument 'obs_space'
WeatherModel.__init__() got multiple values for argument 'obs_space'

Even if it meets the requirements in case of shape(both env and nn model), type
For the rest of the parameters requested in

        TorchModelV2.__init__(
            self, obs_space, action_space, num_outputs, model_config, name
        )

the same situation happens.
if something is unclear, answer anyway and ask.