# PPOConfig + custom\_model = no PPO at all?

**URL:** <https://discuss.ray.io/t/ppoconfig-custom-model-no-ppo-at-all/13282>\
**Category:** Configure Algorithm, Training, Evaluation, Scaling\
**Created:** [December 28, 2023, 7:58pm UTC](https://discuss.ray.io/t/ppoconfig-custom-model-no-ppo-at-all/13282 "2023-12-28T19:58:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BN7002](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/bn7002/32/5551_2.png) [@BN7002](https://discuss.ray.io/u/BN7002)\
**Post date:** [December 28, 2023, 7:58pm UTC](https://discuss.ray.io/t/ppoconfig-custom-model-no-ppo-at-all/13282/1 "2023-12-28T19:58:05Z")

</div>

- 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.

```auto
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

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

```

gives me:

```auto
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

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

```

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