The config file¶
Every run is described by one YAML file. Scripts read it through
MOConfig, which exposes each section as a
property and hands plain values to library functions. Library functions never
receive the config itself. Here is config/mocheetah.yaml:
config/mocheetah.yaml
name: test
save_dir: maako_optimization_network_size
description: ''
algorithm: morlax
env: MOCheetah
backend: np # jnp or np. Always uses jnp for training
env_config:
ctrl_dt: 0.01
sim_dt: 0.01
action_scale: 1.0
history_length: 5
ideal_base_height: 0.5
ideal_base_vel: 0.5
min_base_height: 0.3
add_random_joint_state: False
add_random_pitch: False
reward:
weights:
run: 1.0
height: 10.0
energy: 1.0
alive: 1.0
done: 0
sigmas:
height: 0.01
speed: 0.01
energy: 0.1
imitation: 0.03
optimization:
objectives: [['run'], ['energy'], ['height']]
shared_objectives: ['alive']
labels: ['Running Speed', 'Energy Efficiency', 'Height']
default_scalarization: [1, 1, 1]
termination:
enabled: true # Enable or disable early termination
base_height: 0.2
learning_params:
ppo_params:
action_repeat: 1
batch_size: 64
clipping_epsilon: 0.1
deterministic_eval: true
discounting: 0.98
entropy_cost: 0.01
episode_length: 500
learning_rate: 0.0001305632705197148
max_grad_norm: 1.0
normalize_observations: true
num_envs: 128
num_evals: 15
num_minibatches: 2
num_timesteps: 50000000
num_updates_per_batch: 4
reward_scaling: 1.0
unroll_length: 20
sampling_params:
alpha: 2.385868017680052
k: 32
sampling: sparse-heavytail
warmup_frac: 0.0
morlax_network_params:
hypertype: dual
hypersize: [128, 128]
num_features: 32
policy_hidden_layer_sizes: [64, 64]
value_hidden_layer_sizes: [64, 64]
amor_network_params:
policy_hidden_layer_sizes: [256, 256, 256]
value_hidden_layer_sizes: [256, 256, 256]
ppo_network_params:
policy_hidden_layer_sizes: [64, 64]
value_hidden_layer_sizes: [64, 64]
morlax_warmup_params:
enabled: false
policy: playground-results/SO-MOCheetah/a-good-policy/config.yaml
Top-level keys¶
| Key | Read as | Meaning |
|---|---|---|
name |
cfg.name |
Run name. The run directory is save_dir/name. A run named test may be overwritten and records no git hash. |
save_dir |
cfg.save_dir |
Parent directory for runs made from this config |
algorithm |
cfg.algorithm |
morlax, amor or ppo |
env |
cfg.env_name |
Environment name, mapped to a class by create_environment |
backend |
cfg.backend |
np or jnp for rollouts. Training always uses jnp. |
gaitlib_path |
cfg.gaitlib_path |
Gait library directory (NaviGait only) |
env_config¶
Everything under env_config is passed to the environment as env_params
(cfg.env_params) and read inside it as self.params. Besides ctrl_dt and sim_dt
(read by minimal_mjx), the multi-objective layer reads the reward section:
reward:
weights: # one weight per named reward term
run: 1.0
height: 10.0
energy: 1.0
alive: 1.0
done: 0
optimization:
objectives: [['run'], ['energy'], ['height']]
shared_objectives: ['alive']
labels: ['Running Speed', 'Energy Efficiency', 'Height']
default_scalarization: [1, 1, 1]
| Key | Read as | Meaning |
|---|---|---|
weights |
Weight of each reward term returned by the environment's reward_function |
|
objectives |
cfg.objectives, cfg.num_objectives |
One list of reward terms per objective. Objective i is the weighted sum of the terms in list i. |
shared_objectives |
Weighted terms added to every objective, such as an alive bonus or a control cost | |
labels |
cfg.objective_labels |
Display names for plots |
default_scalarization |
cfg.default_scalarization |
Fixed objective weights used when algorithm: ppo |
The objective grouping is the only place objectives are defined: the environment
returns named terms, and the config decides how they form the reward vector. To train
on a different set of objectives, edit objectives and weights; no code changes are
needed.
The config is locked
MuJoCo Playground locks env_params when the environment is built. Reading a key
that is missing from the YAML raises an error, so add every key the environment
reads to the config.
learning_params¶
| Section | Read as | Used by |
|---|---|---|
ppo_params |
cfg.ppo_params |
All algorithms. PPO settings such as num_timesteps, num_envs, num_evals, episode_length, learning_rate. |
sampling_params |
cfg.sampling_params |
morlax, amor. Tradeoff sampling: sampling, alpha, k, warmup_frac (see Training a policy). |
morlax_network_params |
cfg.morlax_network_params |
morlax. hypertype (single or dual), hypersize, num_features, and the target policy_hidden_layer_sizes / value_hidden_layer_sizes. |
amor_network_params |
cfg.amor_network_params |
amor. policy_hidden_layer_sizes, value_hidden_layer_sizes. |
ppo_network_params |
cfg.ppo_network_params |
ppo. policy_hidden_layer_sizes, value_hidden_layer_sizes. |
For MORLAX, hypertype: single uses one shared feature MLP with separate heads for
the policy and value weights (ActorCriticHypernet);
dual uses a separate feature MLP per head (DualA2CHypernet).
hypersize is the hidden layer sizes of the feature MLP, and num_features its
output width.
Adding a key¶
MOConfig is the only code that knows key names. To add a setting, add a property to
MOConfig and read the property in the script, rather than indexing the YAML
elsewhere: