Skip to content

Commit

Permalink
update benchmark and hyper parameter tuning readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiyueWang25 committed Oct 5, 2023
1 parent 3d93c84 commit f59fea2
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions benchmarking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Configuration files can be loaded either from the CLI or from the Python API. Th
## CLI

```bash
python -m imitation.scripts.<train_script> <algo> with benchmarking/<config_name>.json
python -m imitation.scripts.<train_script> <algo> with src/imitation/config/tuned_hps/<config_name>.json
```
`train_script` can be either 1) `train_imitation` with `algo` as `bc` or `dagger` or 2) `train_adversarial` with `algo` as `gail` or `airl`.

Expand All @@ -16,26 +16,27 @@ python -m imitation.scripts.<train_script> <algo> with benchmarking/<config_name
```python
...
from imitation.scripts.<train_script> import <train_ex>
<train_ex>.run(command_name="<algo>", named_configs=["benchmarking/<config_name>.json"])
<train_ex>.run(command_name="<algo>", named_configs=["src/imitation/config/tuned_hps/<config_name>.json"])
```

# Tuning Hyperparameters

The hyperparameters of any algorithm in imitation can be tuned using the `tuning.py` script.
The hyperparameters of any algorithm in imitation can be tuned using the `scripts/tuning.py`.
The benchmarking hyperparameter configs were generated by tuning the hyperparameters using
the search space defined in the `tuning_config.py` script. The tuning script proceeds in two
phases: 1) The hyperparameters are tuned using the search space provided, and 2) the best
hyperparameter config found in the first phase based on the maximum mean return is
re-evaluated on a separate set of seeds, and the mean and standard deviation of these trials
are reported.
the search space defined in the `scripts/config/tuning.py`.

To tune the hyperparameters of an algorithm using the default search space provided:
The tuning script proceeds in two phases:
1. Tune the hyperparameters using the search space provided.
2. Re-evaluate the best hyperparameter config found in the first phase based on the maximum mean return on a separate set of seeds. Report the mean and standard deviation of these trials.

To use it with the default search space:
```bash
python tuning.py with {algo} 'parallel_run_config.base_named_configs=["{env}"]'
python src/imitation/scripts/tuning.py with <algo> 'parallel_run_config.base_named_configs=["<env>"]'
```

In this command, `{algo}` provides the default search space and settings to be used for
the specific algorithm, which is defined in the `tuning_config.py` script and
`'parallel_run_config.base_named_configs=["{env}"]'` sets the environment to tune the algorithm in.
See the documentation of `tuning.py` and `parallel.py` scripts for many other arguments that can be
In this command:
- `<algo>` provides the default search space and settings for the specific algorithm, which is defined in the `scripts/config/tuning.py`
- `<env>` sets the environment to tune the algorithm in. They are defined in the algo-specifc `scripts/config/train_[adversarial/imitation/preference_comparisons/rl].py` files.

See the documentation of `scripts/tuning.py` and `scripts/parallel.py` for many other arguments that can be
provided through the command line to change the tuning behavior.

0 comments on commit f59fea2

Please sign in to comment.