0

I'm running an autokeras training, and I want to compute the global progress of the training, where the progress is defined by the total epochs run, including previous trials.

Unfortunatelly, I don't know how to get the trial number, or how to keep a global epoch count.

Here it is a snippet of the code:

class ReportingCallback(keras.callbacks.Callback):
   def __init__(self, trials_total)
      self.trials_total = trials_total

   def on_epoch_end(self, epoch, logs=None):
      epochs_per_trial = self.params["epochs"]
      epochs_total = epochs_per_trial * self.trials_total
      i_trial = ????
      epochs_current = (i_trial * epochs_per_trial) + epoch
      print("Progress: " + str() "/" + str(epochs_total) )



def automl(train_x, train_y): 
     max_trials = 5

     clf = ak.StructuredDataClassifier(max_trials=max_trials)  
        
     clf.fit(
           train_x,
           train_y,
           epochs=100,
           callbacks = [ReportingCallback(max_trials)]
     )

Israel Varea
  • 2,600
  • 2
  • 17
  • 24
  • There is [a closed issue](https://github.com/keras-team/keras-tuner/issues/29) on keras-tuner which seems to be related to this problem – tgrandje Nov 26 '21 at 10:39
  • I've been trying to store a list as an argument to the Callback subclass ; appending to it (in place, using append) each time 'set_model' is called doesn't work. I suspect that the trouble here has something to do with multiprocessing/multithreading copies... – tgrandje Nov 26 '21 at 11:05

0 Answers0