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

make ReplayBuffer.load() compatible with v0.2.0. #216

Merged
merged 3 commits into from
Jan 18, 2018

Conversation

mr4msm
Copy link
Contributor

@mr4msm mr4msm commented Jan 10, 2018

If we use ReplayBuffer that loaded a buffer saved with v0.2.0, an error will occur because deque doesn't have sample() method.
This PR makes load() methods of ReplayBuffer and EpisodicReplayBuffer compatible with buffer saved with v0.2.0.

@mr4msm mr4msm changed the title make load() compatible with v0.2.0. make ReplayBuffer.load() compatible with v0.2.0. Jan 12, 2018
Copy link
Member

@toslunar toslunar left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

LGTM except for the detection of v0.2 buffers. Let me fix it before merging.

@@ -153,6 +153,9 @@ def save(self, filename):
def load(self, filename):
with open(filename, 'rb') as f:
self.memory = pickle.load(f)
if not isinstance(self.memory, RandomAccessQueue):
Copy link
Member

Choose a reason for hiding this comment

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

PrioritizedReplayBuffer.load doesn't work well, because the class extends ReplayBuffer and its memory is not RandomAccessQueue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comment.
Sorry, I completely forgot to consider prioritized buffers.

@mr4msm
Copy link
Contributor Author

mr4msm commented Jan 17, 2018

I appreciate your comment, additional commit and PR #217.

@toslunar toslunar merged commit a51847f into chainer:master Jan 18, 2018
@muupan muupan added this to the v0.4 milestone Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants