update save and load

This commit is contained in:
2023-05-31 16:16:24 +08:00
parent 41c70802fd
commit fe2c327f4e
12 changed files with 252 additions and 44 deletions
+4 -4
View File
@@ -43,13 +43,13 @@ class ExperienceBuffer:
self.rewards = rewards
self.advantages = advantages
def save(self, filename):
with open(filename, 'wb') as f:
def save(self, file_path):
with open(file_path, 'wb') as f:
pickle.dump((self.states, self.actions, self.rewards, self.advantages), f)
@classmethod
def load(cls, filename):
with open(filename, 'rb') as f:
def load(cls, file_path):
with open(file_path, 'rb') as f:
states, actions, rewards, advantages = pickle.load(f)
return cls(
states=states,