Skip to content

Commit

Permalink
Patch obs space and update trained agents
Browse files Browse the repository at this point in the history
  • Loading branch information
araffin committed Nov 5, 2024
1 parent 2f7ac9a commit e55201a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### New Features
- Added `CrossQ` hyperparameters for SB3-contrib (@danielpalen)
- Added Gymnasium v1.0 support
- `--custom-objects` in `enjoy.py` now also patches obs space (when bounds are changed) to solve "Observation spaces do not match" errors

### Bug fixes
- Replaced deprecated `huggingface_hub.Repository` when pushing to Hugging Face Hub by the recommended `HfApi` (see https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http) (@cochaviz)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gym==0.26.2
stable-baselines3[extra,tests,docs]>=2.4.0a11,<3.0
box2d-py==2.3.8
pybullet_envs_gymnasium>=0.4.0
pybullet_envs_gymnasium>=0.5.0
# minigrid
cloudpickle>=2.2.1
# optuna plots:
Expand Down
2 changes: 1 addition & 1 deletion rl-trained-agents
3 changes: 3 additions & 0 deletions rl_zoo3/enjoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,15 @@ def enjoy() -> None: # noqa: C901
"learning_rate": 0.0,
"lr_schedule": lambda _: 0.0,
"clip_range": lambda _: 0.0,
"observation_space": env.observation_space, # load models with different obs bounds
}

if "HerReplayBuffer" in hyperparams.get("replay_buffer_class", ""):
kwargs["env"] = env

model = ALGOS[algo].load(model_path, custom_objects=custom_objects, device=args.device, **kwargs)
# Uncomment to save patched file (for instance gym -> gymnasium)
# model.save(model_path)
obs = env.reset()

# Deterministic by default except for atari games
Expand Down

0 comments on commit e55201a

Please sign in to comment.