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:
|
Args:
|
||||||
score (int): now score
|
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:
|
if score != None:
|
||||||
# create an empty file named as score to recored score
|
# create an empty file named as score to recored score
|
||||||
score_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/" + str(round(score))
|
score_dir = self.saveDir+datetime.datetime.now().strftime("%H%M%S") + "/" + str(round(score))
|
||||||
scorefile = open(score_dir,'w')
|
scorefile = open(score_dir,'w')
|
||||||
scorefile.close()
|
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")
|
print("Model's Weights Saved")
|
||||||
|
|
||||||
def loadWeightToModels(self,loadDir):
|
def loadWeightToModels(self,loadDir):
|
||||||
|
Loading…
Reference in New Issue
Block a user