|
1 | 1 | """Configuration for imitation.scripts.train_preference_comparisons_pebble."""
|
2 | 2 |
|
| 3 | +import warnings |
| 4 | + |
3 | 5 | import sacred
|
| 6 | +import stable_baselines3 as sb3 |
4 | 7 |
|
5 | 8 | from imitation.algorithms import preference_comparisons
|
| 9 | +from imitation.policies import base |
6 | 10 | from imitation.scripts.common import common, reward, rl, train
|
7 | 11 |
|
8 | 12 | train_preference_comparisons_pebble_ex = sacred.Experiment(
|
|
15 | 19 | ],
|
16 | 20 | )
|
17 | 21 |
|
18 |
| - |
19 | 22 | MUJOCO_SHARED_LOCALS = dict(rl=dict(rl_kwargs=dict(ent_coef=0.1)))
|
20 | 23 | ANT_SHARED_LOCALS = dict(
|
21 | 24 | total_timesteps=int(3e7),
|
22 | 25 | rl=dict(batch_size=16384),
|
23 | 26 | )
|
24 | 27 |
|
25 | 28 |
|
| 29 | +@rl.rl_ingredient.config |
| 30 | +def rl_sac(): |
| 31 | + # For recommended SAC hyperparams in each environment, see: |
| 32 | + # https://github.com/DLR-RM/rl-baselines3-zoo/blob/master/hyperparams/sac.yml |
| 33 | + rl_cls = sb3.SAC |
| 34 | + warnings.warn( |
| 35 | + "SAC currently only supports continuous action spaces. " |
| 36 | + "Consider adding a discrete version as mentioned here: " |
| 37 | + "https://github.com/DLR-RM/stable-baselines3/issues/505", |
| 38 | + category=RuntimeWarning, |
| 39 | + ) |
| 40 | + # Default HPs are as follows: |
| 41 | + batch_size = 256 # batch size for RL algorithm |
| 42 | + rl_kwargs = dict(batch_size=None) # make sure to set batch size to None |
| 43 | + locals() # quieten flake8 |
| 44 | + |
| 45 | + |
| 46 | +@train.train_ingredient.config |
| 47 | +def train_sac(): |
| 48 | + policy_cls = base.SAC1024Policy # noqa: F841 |
| 49 | + locals() # quieten flake8 |
| 50 | + |
| 51 | + |
| 52 | +@common.common_ingredient.config |
| 53 | +def mountain_car(): |
| 54 | + env_name = "MountainCarContinuous-v0" |
| 55 | + locals() # quieten flake8 |
| 56 | + |
| 57 | + |
26 | 58 | @train_preference_comparisons_pebble_ex.config
|
27 | 59 | def train_defaults():
|
28 | 60 | fragment_length = 100 # timesteps per fragment used for comparisons
|
|
0 commit comments