mbrl-lib
mbrl-lib copied to clipboard
fix epoch/episode iteration bug in mbpo.py
Types of changes
- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Motivation and Context / Related issue
in the for loop that is incrementing the steps of the current epoch, the steps_epoch iteration variable is not being reset after we observe a termination (done=True). This will mean the next epoch will start from the steps_epoch+1 in which the previous epoch ended. And the next epoch will be shorter than the actual epoch length (i.e. epoch_length - steps_epoch)
for steps_epoch in range(cfg.overrides.epoch_length):
if steps_epoch == 0 or done:
obs, done = env.reset(), False
See #159
How Has This Been Tested (if it applies)
Checklist
- [x] The documentation is up-to-date with the changes I made.
- [x] I have read the CONTRIBUTING document and completed the CLA (see CONTRIBUTING).
- [x] All tests passed, and additional code has been covered with new tests.
CI is failing due to a trailing whitespace in the line. To automatically check for this and any other errors, you can install pre-commit
in your conda env and run pre-commit install
; this will set up hooks that will run lint/mypy for any commits. Probably unnecessary for just a single line, but maybe for future PRs :)