You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I was trying our Keras 3.0 it seems that Keras Tuner is crashing due to compatibility problems
First it seems to fail on check “isinstance(model, keras.models.Model)”
165# Stop if "build()" does not return a valid model.166ifnotisinstance(model, keras.models.Model):
-->167raiseerrors.FatalTypeError(
168"Expected the model-building function, or HyperModel.build() "169"to return a valid Keras Model instance. "FatalTypeError: Expectedthemodel-buildingfunction, orHyperModel.build() toreturnavalidKerasModelinstance. Received: <Sequentialname=sequential_1, built=True>oftype<class'keras.src.models.sequential.Sequential'>.
Then there is some problem what is returned from model.fit()
FatalTypeError: Expected the return value of HyperModel.fit() to be one of float, dict, keras.callbacks.History, or a list of one of these types. Recevied return value: <keras.src.callbacks.history.History object at 0x7f5974212050> of type <class 'keras.src.callbacks.history.History'>.
RuntimeError: Number of consecutive failures exceeded the limit of 3.
Traceback (most recent call last):
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/base_tuner.py", line 273, in _try_run_and_update_trial
self._run_and_update_trial(trial, *fit_args, **fit_kwargs)
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/base_tuner.py", line 238, in _run_and_update_trial
results = self.run_trial(trial, *fit_args, **fit_kwargs)
File "/tmp/ipykernel_22160/2305993176.py", line 9, in run_trial
return super(MyTuner, self).run_trial(trial, *args, **kwargs)
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/tuner.py", line 314, in run_trial
obj_value = self._build_and_fit_model(trial, *args, **copied_kwargs)
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/tuner.py", line 233, in _build_and_fit_model
results = self.hypermodel.fit(hp, model, *args, **kwargs)
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/hypermodel.py", line 149, in fit
return model.fit(*args, **kwargs)
File "~/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 123, in error_handler
raise e.with_traceback(filtered_tb) from None
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/tuner_utils.py", line 76, in on_epoch_end
self._save_model()
File "~/.local/lib/python3.10/site-packages/keras_tuner/engine/tuner_utils.py", line 86, in _save_model
self.model.save_weights(write_filepath)
ValueError: The filename must end in `.weights.h5`. Received: filepath=output/FashionMNIST/trial_02/checkpoint
Thank you so much for the issue, @To3No7 !
I am looking into this.
KerasTuner v1.4.5 is build with keras-core instead of keras-nightly.
We will support the keras-nightly soon.
Describe the bug
When I was trying our Keras 3.0 it seems that Keras Tuner is crashing due to compatibility problems
First it seems to fail on check “isinstance(model, keras.models.Model)”
Then there is some problem what is returned from model.fit()
If one get past these two then there are problems with the new way to handle save and load models. C.f. https://groups.google.com/g/keras-users/c/jgGcX730WGE
To Reproduce
I believe this will be true for any example running with Keras 3.0, but here is a colab notebook that shows this behaviour for the first type of crash, if that is fixed then the others will appear!
https://colab.research.google.com/drive/1v-RblPL4XiYY_AmGW47xLL6v5sbq2ggY?usp=sharing
Expected behavior
No crash!
Additional context
TensorFlow version: 2.16.0-dev20231022
Keras version: 3.0.0.dev2023102203
Keras Tuner version: 1.4.5
Would you like to help us fix it?
Would be interested, but not sure I have the knowledge to do that.
The text was updated successfully, but these errors were encountered: