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
Current Tensorflow Version: 2.16.1
Current Keras Version: 3.3.2
Providing input shape in first layer of the model, be it any type of layer (Dense / Conv2D) throws a warning telling to add InputLayer separately to mention input shape. Use InputLayer as the first Layer.
Explicitly convert steps_per_epoch int (Using int()) to avoid "Ran out of Training" Error in case value provided in parameter isn,t integer.
!wget doesn't work in Jupyter Notebook. Use "import wget" works.
Using tensorflow_hub.KerasLayer to get pretrained model from Tensorflow Hub and using it as a Layer in Sequential Model gives an error "ValueError: Only instances of keras.Layer can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7a4ac7e30f40> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)".
I didn't find any specific reason for this but general understanding i got from searching is this issue developed after keras got updated to Version 3 and the issue is not yet resolved.
One simple solution that worked for me is setting environment variable "TF_USE_LEGACY_KERAS = 1" at top of the notebook works. ( Tells tensorflow to use older keras version in the notebook where the environment variable is set).
Using Pre-Trained Models from "tf.keras.applications" results in some pretty horrible accuracy when used with own data (same code provides great accuracy when used in colab, which uses tensorflow version 2.15 currently and hence older keras version).
I didn't find any specific reason for this too, but setting environment variable "TF_USE_LEGACY_KERAS = 1" works at top of the notebook works.
The text was updated successfully, but these errors were encountered:
Hi, Shailya. Are you able to fit the model after explicitly being able to convert steps_per_epoch to int to avoid running out of data? The value provided to the eteps_per_epoch is already an integer in my case.
This doesn't work in the Tf 2.17.0 version. So, I had to create another env for tf 2.15.0 that works like the videos without converting to int.
Maybe you need to use len(training data) / batch size if you have used batching while preparing training data.
Also, yes the issue still persists in 2.17, I guess. Downgrading to 2.15 is best option. Or you can use legacy keras environment variable like I mentioned if you don't want to download.
Hi Shailya, Thank you SO much for solving a glitch in my notebook. I imported "os" at the beginning of my notebook and set "os.environ["TF_USE_LEGACY_KERAS"] = "1" like you suggested and it worked!! : )
Current Tensorflow Version: 2.16.1
Current Keras Version: 3.3.2
Explicitly convert steps_per_epoch int (Using int()) to avoid "Ran out of Training" Error in case value provided in parameter isn,t integer.
!wget doesn't work in Jupyter Notebook. Use "import wget" works.
keras.Layer
can be added to a Sequential model. Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7a4ac7e30f40> (of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)".I didn't find any specific reason for this but general understanding i got from searching is this issue developed after keras got updated to Version 3 and the issue is not yet resolved.
One simple solution that worked for me is setting environment variable "TF_USE_LEGACY_KERAS = 1" at top of the notebook works. ( Tells tensorflow to use older keras version in the notebook where the environment variable is set).
I didn't find any specific reason for this too, but setting environment variable "TF_USE_LEGACY_KERAS = 1" works at top of the notebook works.
The text was updated successfully, but these errors were encountered: