Skip to content

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

Merged
toslunar merged 3 commits intochainer:masterfrom
mr4msm:make_load_compatible_with_v02
Jan 18, 2018
Merged

make ReplayBuffer.load() compatible with v0.2.0.#216
toslunar merged 3 commits intochainer:masterfrom
mr4msm:make_load_compatible_with_v02

Conversation

@mr4msm
Copy link
Copy Markdown
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
Copy Markdown
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.

def load(self, filename):
with open(filename, 'rb') as f:
self.memory = pickle.load(f)
if not isinstance(self.memory, RandomAccessQueue):
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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