Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
araffin committed Oct 2, 2022
1 parent c280a92 commit 8cbe79d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ python enjoy.py --algo algo_name --env env_id -f logs/ --exp-id 1 --load-last-ch

Upload model to hub (same syntax as for `enjoy.py`):
```
python -m utils.push_to_hub --algo ppo --env CartPole-v1 -f logs/ -orga sb3 -m "Initial commit"
python -m rl_zoo.push_to_hub --algo ppo --env CartPole-v1 -f logs/ -orga sb3 -m "Initial commit"
```
you can choose custom `repo-name` (default: `{algo}-{env_id}`) by passing a `--repo-name` argument.

Download model from hub:
```
python -m utils.load_from_hub --algo ppo --env CartPole-v1 -f logs/ -orga sb3
python -m rl_zoo.load_from_hub --algo ppo --env CartPole-v1 -f logs/ -orga sb3
```

## Hyperparameter yaml syntax
Expand Down Expand Up @@ -255,7 +255,7 @@ for multiple, specify a list:
```yaml
env_wrapper:
- utils.wrappers.DoneOnSuccessWrapper:
- rl_zoo.wrappers.DoneOnSuccessWrapper:
reward_offset: 1.0
- sb3_contrib.common.wrappers.TimeFeatureWrapper
```
Expand All @@ -279,7 +279,7 @@ Following the same syntax as env wrappers, you can also add custom callbacks to

```yaml
callback:
- utils.callbacks.ParallelTrainCallback:
- rl_zoo.callbacks.ParallelTrainCallback:
gradient_steps: 256
```

Expand All @@ -306,19 +306,19 @@ Note: if you want to pass a string, you need to escape it like that: `my_string:
Record 1000 steps with the latest saved model:

```
python -m utils.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000
python -m rl_zoo.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000
```

Use the best saved model instead:

```
python -m utils.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000 --load-best
python -m rl_zoo.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000 --load-best
```

Record a video of a checkpoint saved during training (here the checkpoint name is `rl_model_10000_steps.zip`):

```
python -m utils.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000 --load-checkpoint 10000
python -m rl_zoo.record_video --algo ppo --env BipedalWalkerHardcore-v3 -n 1000 --load-checkpoint 10000
```

## Record a Video of a Training Experiment
Expand All @@ -328,18 +328,18 @@ Apart from recording videos of specific saved models, it is also possible to rec
Record 1000 steps for each checkpoint, latest and best saved models:

```
python -m utils.record_training --algo ppo --env CartPole-v1 -n 1000 -f logs --deterministic
python -m rl_zoo.record_training --algo ppo --env CartPole-v1 -n 1000 -f logs --deterministic
```

The previous command will create a `mp4` file. To convert this file to `gif` format as well:

```
python -m utils.record_training --algo ppo --env CartPole-v1 -n 1000 -f logs --deterministic --gif
python -m rl_zoo.record_training --algo ppo --env CartPole-v1 -n 1000 -f logs --deterministic --gif
```

## Current Collection: 195+ Trained Agents!

Final performance of the trained agents can be found in [`benchmark.md`](./benchmark.md). To compute them, simply run `python -m utils.benchmark`.
Final performance of the trained agents can be found in [`benchmark.md`](./benchmark.md). To compute them, simply run `python -m rl_zoo.benchmark`.

List and videos of trained agents can be found on our Huggingface page: https://huggingface.co/sb3

Expand Down
6 changes: 3 additions & 3 deletions rl_zoo/record_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@
args_final_model.append("--deterministic")

if os.path.exists(os.path.join(log_path, f"{env_name}.zip")):
return_code = subprocess.call(["python", "-m", "utils.record_video"] + args_final_model)
return_code = subprocess.call(["python", "-m", "rl_zoo.record_video"] + args_final_model)
assert return_code == 0, "Failed to record the final model"

if os.path.exists(os.path.join(log_path, "best_model.zip")):
args_best_model = args_final_model + ["--load-best"]
return_code = subprocess.call(["python", "-m", "utils.record_video"] + args_best_model)
return_code = subprocess.call(["python", "-m", "rl_zoo.record_video"] + args_best_model)
assert return_code == 0, "Failed to record the best model"

args_checkpoint = args_final_model + ["--load-checkpoint"]
args_checkpoint.append("0")
for checkpoint in checkpoints:
args_checkpoint[-1] = str(checkpoint)
return_code = subprocess.call(["python", "-m", "utils.record_video"] + args_checkpoint)
return_code = subprocess.call(["python", "-m", "rl_zoo.record_video"] + args_checkpoint)
assert return_code == 0, f"Failed to record the {checkpoint} checkpoint model"

# add text to each video
Expand Down

0 comments on commit 8cbe79d

Please sign in to comment.