Skip to content
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

Implementation bug in Prioritized Experience Replay #329

Open
ModernGangster opened this issue Aug 18, 2023 · 1 comment
Open

Implementation bug in Prioritized Experience Replay #329

ModernGangster opened this issue Aug 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ModernGangster
Copy link

File "/home/moderngangster/Codes/APC-Flight/ElegantRL/examples/../elegantrl/agents/AgentSAC.py", line 43, in update_net
obj_critic, state = self.get_obj_critic(buffer, self.batch_size)
File "/home/moderngangster/Codes/APC-Flight/ElegantRL/examples/../elegantrl/agents/AgentSAC.py", line 81, in get_obj_critic_per
states, actions, rewards, undones, next_ss, is_weights, is_indices = buffer.sample_for_per(batch_size)
File "/home/moderngangster/Codes/APC-Flight/ElegantRL/examples/../elegantrl/train/replay_buffer.py", line 134, in sample_for_per
_is_indices, _is_weights = sum_tree.important_sampling(batch_size, beg, end, self.per_beta)
File "/home/moderngangster/Codes/APC-Flight/ElegantRL/examples/../elegantrl/train/replay_buffer.py", line 267, in important_sampling
assert 0 <= i

@YangletLiu YangletLiu added the bug Something isn't working label Aug 18, 2023
@ChenqiuXD
Copy link

I fixed this bug by modifying the 'update_ids()' function in class SumTree. I recall that I modified the iterate depth in that function. You can check the sum of all nodes of the binary tree, i.e., the tree[0], by ensuring that 'update_ids()' function functions correctly. However, it seems the weight calculation also embeds some bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants