Skip to content

Commit

Permalink
Added KERAS2 compatibility mode to e2gmm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sludtke42 committed Oct 5, 2024
1 parent 336971d commit 66d793e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions programs/e2gmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
if "CUDA_VISIBLE_DEVICES" not in os.environ: os.environ["CUDA_VISIBLE_DEVICES"]='0'
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"]='true'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #### reduce log output
if argv[1]=="--old" :
print("KERAS2 compatibility mode invoked. Please do not use this for new runs of e2gmm.py, only for accessing historical runs which can't be read otherwise.")
os.environ["TF_USE_LEGACY_KERAS")="1" # This needs to be before tensorflow is imported ... I think

import traceback
import tensorflow as tf
Expand Down Expand Up @@ -2537,8 +2540,10 @@ def sel_run(self,line):
try:
self.decoder = tf.keras.models.load_model(f"{self.gmm}/{self.currunkey}_decoder.h5",compile=False)
except:
traceback.print_exc()
print(f"Run {self.gmm} -> {self.currunkey} results incomplete. No stored decoder found.",self)
traceback.print_exc(limit=1)
print("...")
traceback.print_exc(limit=-1)
print(f"Run {self.gmm} -> {self.currunkey} error reading decoder.\n\nThis either means you haven't run the GMM yet, in which case this is normal, -OR-\nyou ran the GMM with an older version of Keras, in which case, please quit e2gmm, and rerun it with the --old option.",self)
self.set3dvis(1,0,0,0,0,1)
get_application().restoreOverrideCursor()
return
Expand Down

0 comments on commit 66d793e

Please sign in to comment.