aporia-ai / mlnotify

🔔 No need to keep checking your training - just one import line and you'll know the second it's done.
https://mlnotify.aporia.com
MIT License
344 stars 19 forks source link

Error when training the same model few times #40

Closed yonikremer closed 3 years ago

yonikremer commented 3 years ago

My notebook : https://colab.research.google.com/drive/1yTwFNn0QbQKYT7o4_ZrkxsCdSGWtAP7G?usp=sharing

Error: TypeError: set_model() missing 1 required positional argument: 'model'

To Reproduce open a notebook in google colab import the latest version of tensorflow 2.6 import mlnotify build a Sequential model and save to the variable model compile the model train and save a variable history(a=model.fit) (everything was going good) train again and save to another variable(b=model.fit) now you get an error

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here. Full Error: TypeError Traceback (most recent call last)

in () ----> 1 history2 = model.fit(x=trainx, y=trainy, batch_size=64, epochs=20, callbacks=tf.keras.callbacks.TensorBoard) 3 frames /usr/local/lib/python3.7/dist-packages/mlnotify/hooks.py in base_patch_func(__original_func, __before, __after, *args, **kwargs) 30 logger.debug("Failed to run hook function (before)", exc_info=True) 31 ---> 32 res = __original_func(*args, **kwargs) 33 34 try: /usr/local/lib/python3.7/dist-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing) 1157 verbose=verbose, 1158 epochs=epochs, -> 1159 steps=data_handler.inferred_steps) 1160 1161 self.stop_training = False /usr/local/lib/python3.7/dist-packages/keras/callbacks.py in __init__(self, callbacks, add_history, add_progbar, model, **params) 208 209 if model: --> 210 self.set_model(model) 211 if params: 212 self.set_params(params) /usr/local/lib/python3.7/dist-packages/keras/callbacks.py in set_model(self, model) 283 model.history = self._history 284 for callback in self.callbacks: --> 285 callback.set_model(model) 286 287 def _call_batch_hook(self, mode, hook, batch, logs=None): TypeError: set_model() missing 1 required positional argument: 'model'
yonikremer commented 3 years ago

I tried to delete and unistall the pakage, I also tried to save the model to diffrent variable it didnt work

yonikremer commented 3 years ago

The bug wasn't in this pakage, it was because of tensorboard