keras-team / keras-tuner

A Hyperparameter Tuning Library for Keras
https://keras.io/keras_tuner/
Apache License 2.0
2.86k stars 396 forks source link

Wrong TypeError #1003

Open Sorooshi opened 8 months ago

Sorooshi commented 8 months ago

Describe the bug

I am trying to fine-tune an AE-LSTM, using keras tuner, to use the output of the embedding layer in the rest of my project.

To this end, I have defined two classes, one for train and test the fine-tuned model, which I called "LstmAe", and the other to fine-tune it, which I called "ApplyLstmAe."

The problem is when I try execute my fine_tune_the_model() method in the latter class I face the following error:

TypeError: Inputs to a layer should be tensors. Got: <keras_tuner.src.engine.hyperparameters.hyperparameters.HyperParameters object at 0x7fdc7c3438e0>

My failed attempted:

Changing build method as staticmethod, define "hps" inside the build function, changing InputLayer to Input etc., unfortunately I failed.
Googling also did not help me to find a proper answer (although one unanswered post on SO and one issue on GitHub are available).

To Reproduce

In the link below you can find the google-colab file, however, I cannot share the data https://colab.research.google.com/drive/1rJMqaeAjsKvWvI3EcdiHY2ZPxCJCKu-y?usp=sharing

Expected behavior

Method fine_tune_the_model does not accept any inputs, I expect it to initiate the tuner; however, instead it produces such an error.

Would you like to help us fix it? Unofortunately, I cannot help.