Model.evaluate() returning a float, not a list
I have a multi-task neural network. I want to make sure that when I call Model.evaluate()
on my model, that the score I see is the sum of the losses. However, it is returning a scalar rather than a list, so I am not sure what this loss is. According to the documentation, a list of scalars should be returned for multiple outputs or losses. Below is a minimal reproducible example
Infer every epoch during training with load current weight with instantiate new model with specified input shape
I have this callback:
A KerasTensor cannot be used as input to a TensorFlow function
I have been following a machine-learning book by Chollet and I keep getting this error in this block of code, specifically in the 3rd line. It seems I am passing a Keras tensor into a tf function but I don’t know how to get around this.
Tensorflow.keras import issues
I am creating a simple AI. I am using TensorFlow and Keras in python and receiving an attribute error from the imports.
Tensorflow/Keras model raises output shape errors when loaded in another system
I have a tf.keras lstm model that I trained on Google Colab and I want to load it on my laptop so I can run it to do inference.
I created a Python virtual environment on my laptop with the same versions of Tensorflow/Keras as Google Colab (2.15) and the same version of Python (3.10).
Despite this, when I load the model I get the following errors:
Problems using tensorflow
Error loading model in keras. Please help me
Traceback (most recent call last):
File “C:Users250004460DesktopBackupPython filesMicroservicescat_dog_classifier.py”, line 27, in
get_model()
File “C:Users250004460DesktopBackupPython filesMicroservicescat_dog_classifier.py”, line 17, in get_model
model=tf.keras.models.load_model(‘cat_dog_classifier.h5’)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:Users250004460AppDataLocalanaconda3Libsite-packageskerassrcsavingsaving_api.py”, line 183, in load_model
return legacy_h5_format.load_model_from_hdf5(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:Users250004460AppDataLocalanaconda3Libsite-packageskerassrclegacysavinglegacy_h5_format.py”, line 133, in load_model_from_hdf5
model = saving_utils.model_from_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:Users250004460AppDataLocalanaconda3Libsite-packageskerassrclegacysavingsaving_utils.py”, line 58, in model_from_config
batch_input_shape = config[“config”].pop(“batch_input_shape”, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: pop expected at most 1 argument, got 2
AttributeError: ‘Sequential’ object has no attribute ‘compiled’
I use GridSearch to optimize LSTM with different combinations of hyperparameters.
Why am I not receiving gradients when training my tf model with a custom loss expression?
The loss function works as intended, but I’m not getting any gradients computed. batter_cdfs is just a 2150×10 array of floats between 0 and 1.
The loss function is supposed to, in essence, return the log-prob of a single observation from a joint distribution that the model would generate.
What is the difference between tf.keras.models.Sequential() and tf.keras.Sequential()?
I have just started building neural networks with tensorflow and different online resources have different ways of creating them. One thing I have noticed is how the sequential API is implemented. Some use tf.keras.Sequential() while others use tf.keras.models.Sequential()? Can anyone tell me the difference and when to use one over the other?