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

Fix PrioritizedReplayBuffer filtering #232

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

alexandrelarouche
Copy link
Contributor

Fix error where add() crashes if no trajectory is better than buffer trajectories.

Specifically, the following lines gave results which couldn't be handled because the Trajectories object was empty:

                batch = training_objects.last_states.tensor.float()
                batch_dim = training_objects.last_states.batch_shape[0]
                try:
                    batch_batch_dist = torch.cdist(
                        batch.view(batch_dim, -1).unsqueeze(0),
                        batch.view(batch_dim, -1).unsqueeze(0),
                        p=self.p_norm_distance,
                    ).squeeze(0)

Fix is trivial: flow control out of the function if no trajectories should be added to the buffer.

Fix error where add crashes if no trajectory is better than buffer
trajectories.
Copy link
Collaborator

@josephdviviano josephdviviano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome - thanks for the fix!

@josephdviviano josephdviviano merged commit 59a1efa into GFNOrg:master Jan 24, 2025
4 checks passed
@alexandrelarouche alexandrelarouche deleted the buffer_filter_fix branch January 27, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants