-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RLlib] Fix bug in SingleAgentEnvRunner: Calling sample()
would always force-reset the vector env (even if episodes were not completed in a previous call).
#41168
Conversation
rllib/algorithms/ppo/ppo.py
Outdated
# TEST | ||
#import pickle | ||
#import torch | ||
#import os | ||
#with open("train_batch.pkl", "wb") as file: | ||
# pickle.dump(train_batch, file) | ||
#torch.save(self.workers.local_worker().policy_map["default_policy"].model.state_dict(), "model_weights.pth") | ||
# END TEST | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, will comb through changes and clean everything up before merging. Thanks for this catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
rllib/algorithms/ppo/ppo.py
Outdated
# TEST | ||
#import pickle | ||
#import torch | ||
#import os | ||
#from ray.rllib.utils.test_utils import check | ||
#rw_path = "/Users/sven/ray_results/PPO_2023-11-15_13-28-16/PPO_CartPoleDebug_74001_00000_0_2023-11-15_13-28-16" | ||
#with open(os.path.join(rw_path, "train_batch.pkl"), "rb") as file: | ||
# rw_train_batch = pickle.load(file) | ||
#rw_state_dict = torch.load(os.path.join(rw_path, "model_weights.pth")) | ||
#self.workers.local_worker().module.load_state_dict(rw_state_dict) | ||
# END TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
rllib/algorithms/ppo/ppo.py
Outdated
#check(train_batch["advantages"], rw_train_batch["default_policy"]["advantages"], rtol=0.000001) | ||
#check(train_batch["vf_preds"], rw_train_batch["default_policy"]["vf_preds"]) | ||
#check(train_batch["value_targets"], rw_train_batch["default_policy"]["value_targets"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…single_agent_env_runner_force_reset_bug
sample()
repeatedly would always force-reset the vector env (even if episodes were not completed in a previous call).sample()
would always force-reset the vector env (even if episodes were not completed in a previous call).
…ays force-reset the vector env (even if episodes were not completed in a previous call). (ray-project#41168)
Fix bug in SingleAgentEnvRunner: Calling
sample()
repeatedly would always force-reset the vector env (even if episodes were not completed in a previous call).Why are these changes needed?
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.