# How to set configuration in tune for sac algorithm?

**URL:** <https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412>\
**Category:** RLlib\
**Created:** [January 9, 2021, 1:55pm UTC](https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412 "2021-01-09T13:55:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Pirog](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/peter_pirog/32/234_2.png) [@Peter\_Pirog](https://discuss.ray.io/u/Peter_Pirog)\
**Post date:** [January 9, 2021, 1:55pm UTC](https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412/1 "2021-01-09T13:55:04Z")

</div>

I try to set configuration for SAC algorithm in ray.tune.

My ray tune is configured:

> analysis = tune.run(  
> run\_or\_experiment=“SAC”, # check if your environment is continuous or discrete before choosing training algorithm [Algorithms — Ray 3.0.0.dev0](https://docs.ray.io/en/master/rllib-algorithms.html#soft-actor-critic-sac)  
> scheduler=asha\_scheduler,  
> stop={“episode\_reward\_mean”: 200}, # stop training if this value is reached  
> mode=‘max’, # find maximum vale as a target  
> config=config,

My configuration dict is:

> config = {  
> “env”: “CartPole-v0”, # name of environment from gym library, it can be defined by user, example:  
> “num\_gpus”: 1, #number of GPUs for trainer, remember even with GPU trainer needs 1 CPU  
> “num\_workers”: 7, # number of workers for one trainer  
> “lr”: tune.grid\_search([0.01, 0.001, 0.0001]), # or “lr”: tune.uniform(0.0001, 0.01)  
> “framework”: “tf2”, # configuration to use tensorflow 2 as a main framework
> 
> ```
> # Model options for the Q network(s).
> "Q_model": {
> "fcnet_activation": "relu",
> "fcnet_hiddens": [256, 256],
> },
> # Model options for the policy function.
> "policy_model": {
> "fcnet_activation": "relu",
> "fcnet_hiddens": [256, 256],
> },
> 
> ```
> 
> }

But the error is:

> When not using a state-preprocessor with SAC, `fcnet_hiddens` will be set to an empty list! Any hidden layer sizes are defined via `policy_model.fcnet_hiddens` and `Q_model.fcnet_hiddens`.

I don’t know how to solve it because hidden layers are defined in config dictionary, for PPO algorithm it worked fine.  
I will be thankful for any suggestions.

Peter

---

<div class="post-metadata">

**Author:** ![Peter\_Pirog](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/peter_pirog/32/234_2.png) [@Peter\_Pirog](https://discuss.ray.io/u/Peter_Pirog)\
**Post date:** [January 11, 2021, 12:51pm UTC](https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412/2 "2021-01-11T12:51:11Z")

</div>

If someone tested layers configurations for other algorithms it will be useful too. As far I tested tune with success only for PPO algorithm, I tuned only lr.  
Maybe I define nested config parameters in wrong way??

```auto
"Q_model": {
    "fcnet_activation": "relu",
    "fcnet_hiddens": [256, 256],
}

```

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [January 13, 2021, 10:47am UTC](https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412/3 "2021-01-13T10:47:17Z")

</div>

Thanks for the question @Peter_Pirog .  
This is just a warning, but yes, it’s a little confusing b/c you do seem to have the correct config, with both  
`Q_model.fcnet_hiddens` and `policy_model.fcnet_hiddens` specified.  
We should suppress this warning, if this is the case. Will provide a PR. …

---

<div class="post-metadata">

**Author:** ![Peter\_Pirog](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/peter_pirog/32/234_2.png) [@Peter\_Pirog](https://discuss.ray.io/u/Peter_Pirog)\
**Post date:** [January 13, 2021, 11:53am UTC](https://discuss.ray.io/t/how-to-set-configuration-in-tune-for-sac-algorithm/412/4 "2021-01-13T11:53:45Z")

</div>

Thank You @sven1977 for the answer. These warning was a little confusing for me. The configuration of some algorithms isn’t obvious but I think it’s worth of effort. Peter
