@@ -233,15 +233,15 @@ def updateModel(model, model_path, update_num, reload_epoch=True, full_path=Fals
233
233
logger .info ("<<< Updating model " + model_name + " from " + model_path + " ... >>>" )
234
234
235
235
try :
236
- logger .info ("<<< Updating model from " + model_path + ".h5 ... >>>" )
237
- model .model .set_weights (load_model (model_path + '.h5' , compile = False ).get_weights ())
236
+ logger .info ("<<< Updating model from " + model_name + ".h5 ... >>>" )
237
+ model .model .set_weights (load_model (model_name + '.h5' , compile = False ).get_weights ())
238
238
239
239
except Exception as e :
240
240
logger .info (str (e ))
241
241
# Load model structure
242
- logger .info ("<<< Failed -> Loading model from " + model_path + "_weights.h5' ... >>>" )
242
+ logger .info ("<<< Failed -> Loading model from " + model_name + "_weights.h5' ... >>>" )
243
243
# Load model weights
244
- model .model .load_weights (model_path + '_weights.h5' )
244
+ model .model .load_weights (model_name + '_weights.h5' )
245
245
246
246
# Load auxiliary models for optimized search
247
247
if os .path .exists (model_name + '_init.h5' ) and os .path .exists (model_name + '_next.h5' ):
@@ -254,17 +254,17 @@ def updateModel(model, model_path, update_num, reload_epoch=True, full_path=Fals
254
254
if loading_optimized != 0 :
255
255
logger .info ("<<< Updating optimized model... >>>" )
256
256
if loading_optimized == 1 :
257
- logger .info ("\t <<< Updating model_init from " + model_path + "_init.h5 ... >>>" )
258
- model .model_init .set_weights (load_model (model_path + '_init.h5' , compile = False ).get_weights ())
259
- logger .info ("\t <<< Updating model_next from " + model_path + "_next.h5 ... >>>" )
260
- model .model_next .set_weights (load_model (model_path + '_next.h5' , compile = False ).get_weights ())
257
+ logger .info ("\t <<< Updating model_init from " + model_name + "_init.h5 ... >>>" )
258
+ model .model_init .set_weights (load_model (model_name + '_init.h5' , compile = False ).get_weights ())
259
+ logger .info ("\t <<< Updating model_next from " + model_name + "_next.h5 ... >>>" )
260
+ model .model_next .set_weights (load_model (model_name + '_next.h5' , compile = False ).get_weights ())
261
261
elif loading_optimized == 2 :
262
- logger .info ("\t <<< Updating model_init from " + model_path + "_structure_init.json ... >>>" )
263
- model .model_init .load_weights (model_path + '_weights_init.h5' )
262
+ logger .info ("\t <<< Updating model_init from " + model_name + "_structure_init.json ... >>>" )
263
+ model .model_init .load_weights (model_name + '_weights_init.h5' )
264
264
# Load model structure
265
- logger .info ("\t <<< Updating model_next from " + model_path + "_structure_next.json ... >>>" )
265
+ logger .info ("\t <<< Updating model_next from " + model_name + "_structure_next.json ... >>>" )
266
266
# Load model weights
267
- model .model_next .load_weights (model_path + '_weights_next.h5' )
267
+ model .model_next .load_weights (model_name + '_weights_next.h5' )
268
268
269
269
logger .info ("<<< Model updated in %0.6s seconds. >>>" % str (time .time () - t ))
270
270
return model
0 commit comments