writing vizualization docs
This commit is contained in:
12
README.md
12
README.md
@@ -109,17 +109,9 @@ python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=0 --
|
|||||||
|
|
||||||
*NOTE:* At the moment Mujoco training uses VecNormalize wrapper for the environment which is not being saved correctly; so loading the models trained on Mujoco will not work well if the environment is recreated. If necessary, you can work around that by replacing RunningMeanStd by TfRunningMeanStd in [baselines/common/vec_env/vec_normalize.py](baselines/common/vec_env/vec_normalize.py#L12). This way, mean and std of environment normalizing wrapper will be saved in tensorflow variables and included in the model file; however, training is slower that way - hence not including it by default
|
*NOTE:* At the moment Mujoco training uses VecNormalize wrapper for the environment which is not being saved correctly; so loading the models trained on Mujoco will not work well if the environment is recreated. If necessary, you can work around that by replacing RunningMeanStd by TfRunningMeanStd in [baselines/common/vec_env/vec_normalize.py](baselines/common/vec_env/vec_normalize.py#L12). This way, mean and std of environment normalizing wrapper will be saved in tensorflow variables and included in the model file; however, training is slower that way - hence not including it by default
|
||||||
|
|
||||||
|
## Loading and vizualizing learning curves and other training metrics
|
||||||
|
See [here](docs/viz/viz.md) for instructions on how to load and display the training data.
|
||||||
|
|
||||||
## Using baselines with TensorBoard
|
|
||||||
Baselines logger can save data in the TensorBoard format. To do so, set environment variables `OPENAI_LOG_FORMAT` and `OPENAI_LOGDIR`:
|
|
||||||
```bash
|
|
||||||
export OPENAI_LOG_FORMAT='stdout,log,csv,tensorboard' # formats are comma-separated, but for tensorboard you only really need the last one
|
|
||||||
export OPENAI_LOGDIR=path/to/tensorboard/data
|
|
||||||
```
|
|
||||||
And you can now start TensorBoard with:
|
|
||||||
```bash
|
|
||||||
tensorboard --logdir=$OPENAI_LOGDIR
|
|
||||||
```
|
|
||||||
## Subpackages
|
## Subpackages
|
||||||
|
|
||||||
- [A2C](baselines/a2c)
|
- [A2C](baselines/a2c)
|
||||||
|
@@ -10,16 +10,41 @@ you can see the location of logger directory at the beginning of the training in
|
|||||||
Logging to /var/folders/mq/tgrn7bs17s1fnhlwt314b2fm0000gn/T/openai-2018-10-29-15-03-13-537078
|
Logging to /var/folders/mq/tgrn7bs17s1fnhlwt314b2fm0000gn/T/openai-2018-10-29-15-03-13-537078
|
||||||
```
|
```
|
||||||
The location can be changed by changing `OPENAI_LOGDIR` environment variable; for instance:
|
The location can be changed by changing `OPENAI_LOGDIR` environment variable; for instance:
|
||||||
```
|
```bash
|
||||||
export OPENAI_LOGDIR=$HOME/models/mujoco-ppo-humanoid
|
export OPENAI_LOGDIR=$HOME/models/mujoco-ppo-humanoid
|
||||||
python -m baselines.run --alg=ppo2 --env=Humanoid-v2
|
python -m baselines.run --alg=ppo2 --env=Humanoid-v2
|
||||||
```
|
```
|
||||||
will log data to `~/models/mujoco-ppo-humanoid`.
|
will log data to `~/models/mujoco-ppo-humanoid`.
|
||||||
|
|
||||||
## Using TensorBoard
|
## Using TensorBoard
|
||||||
One of the most straightforward ways to visualize data is to use TensorBoard (). Baselines logger can dump data in tensorboard-compatible format.
|
One of the most straightforward ways to visualize data is to use [TensorBoard](https://www.tensorflow.org/guide/summaries_and_tensorboard). Baselines logger can dump data in tensorboard-compatible format; to
|
||||||
|
set that up, set environment variables `OPENAI_LOG_FORMAT`
|
||||||
|
```bash
|
||||||
|
export OPENAI_LOG_FORMAT='stdout,log,csv,tensorboard' # formats are comma-separated, but for tensorboard you only really need the last one
|
||||||
|
```
|
||||||
|
And you can now start TensorBoard with:
|
||||||
|
```bash
|
||||||
|
tensorboard --logdir=$OPENAI_LOGDIR
|
||||||
|
```
|
||||||
|
|
||||||
## Loading summaries of the results
|
## Loading summaries of the results
|
||||||
|
If the summary overview provided by tensorboard is not sufficient, and you would like to either access to raw environment episode data, or use complex post-processing notavailable in tensorboard, you can load results into python as [pandas](https://pandas.pydata.org/) dataframes.
|
||||||
|
For instance, the following snippet:
|
||||||
|
```python
|
||||||
|
from baselines.common import plot_util
|
||||||
|
results = plot_util.load_results('<path_to_logdir>')
|
||||||
|
```
|
||||||
|
will search for all folders with baselines-compatible results in `<path_to_logdir>` and subfolders and
|
||||||
|
return a list of Result objects. Each Result object is a named tuple with the following fields:
|
||||||
|
|
||||||
|
- dirname: str - name of the folder from which data was loaded
|
||||||
|
|
||||||
|
- metadata: dict) - dictionary with various metadata (read from metadata.json file)
|
||||||
|
|
||||||
|
- progress: pandas.DataFrame - tabular data saved by logger as a pandas dataframe. Available if csv is in logger formats.
|
||||||
|
|
||||||
|
- monitor: pandas.DataFrame - raw episode data (length, episode reward, timestamp). Available if environment wrapped with [Monitor](baselines/bench/monitor.py) wrapper
|
||||||
|
|
||||||
|
|
||||||
## Plotting: standalone
|
## Plotting: standalone
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user