1919import os ,sys
2020import numpy as np
2121from copy import deepcopy
22- from plasma .utils .downloading import makedirs_process_safe
22+ from plasma .utils .downloading import makedirs_process_safe , general_object_hash
2323
2424import hashlib
2525
@@ -31,18 +31,22 @@ def on_batch_end(self, batch, logs=None):
3131 self .losses .append (logs .get ('loss' ))
3232
3333
34+
3435class ModelBuilder (object ):
3536 def __init__ (self ,conf ):
3637 self .conf = conf
3738
3839 def get_unique_id (self ):
39- num_epochs = self .conf ['training' ]['num_epochs' ]
40+ # num_epochs = self.conf['training']['num_epochs']
4041 this_conf = deepcopy (self .conf )
41- #don't make hash dependent on number of epochs.
42+ #don't make hash dependent on number of epochs or T_min_warn as those can be modified
4243 this_conf ['training' ]['num_epochs' ] = 0
43- unique_id = int (hashlib .md5 ((dill .dumps (this_conf ).decode ('unicode_escape' )).encode ('utf-8' )).hexdigest (),16 )
44+ this_conf ['data' ]['T_min_warn' ] = 30
45+ #unique_id = int(hashlib.md5((dill.dumps(this_conf).decode('unicode_escape')).encode('utf-8')).hexdigest(),16)
46+ unique_id = general_object_hash (this_conf )
4447 return unique_id
4548
49+
4650 def get_0D_1D_indices (self ):
4751 #make sure all 1D indices are contiguous in the end!
4852 use_signals = self .conf ['paths' ]['use_signals' ]
@@ -270,6 +274,8 @@ def get_all_saved_files(self):
270274 self .ensure_save_directory ()
271275 unique_id = self .get_unique_id ()
272276 filenames = os .listdir (self .conf ['paths' ]['model_save_path' ])
277+ print ("All saved files with id {} and path {}" .format (unique_id ,self .conf ['paths' ]['model_save_path' ]))
278+ print (filenames )
273279 epochs = []
274280 for file in filenames :
275281 curr_id ,epoch = self .extract_id_and_epoch_from_filename (file )
0 commit comments