Fix python can't save score file issue
This commit is contained in:
parent
8eb64fb75e
commit
0a07b03b7b
@ -399,15 +399,15 @@ class PPO(object):
|
||||
Args:
|
||||
score (int): now score
|
||||
"""
|
||||
actor_save_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/actor/" + "actor.ckpt"
|
||||
critic_save_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/critic/" + "critic.ckpt"
|
||||
self.actor.save_weights(actor_save_dir, save_format="tf")
|
||||
self.critic.save_weights(critic_save_dir, save_format="tf")
|
||||
if score != None:
|
||||
# create an empty file named as score to recored score
|
||||
score_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/" + str(round(score))
|
||||
scorefile = open(score_dir,'w')
|
||||
scorefile.close()
|
||||
actor_save_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/actor/" + "actor.ckpt"
|
||||
critic_save_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/critic/" + "critic.ckpt"
|
||||
self.actor.save_weights(actor_save_dir, save_format="tf")
|
||||
self.critic.save_weights(critic_save_dir, save_format="tf")
|
||||
print("Model's Weights Saved")
|
||||
|
||||
def loadWeightToModels(self,loadDir):
|
||||
|
Loading…
Reference in New Issue
Block a user