Open ohilo12 opened 3 weeks ago
Instead of using objects in Model.compile
, can you try to give strings like adam
, etc.
Hey, thank you for your answer. I have tried:
Modell.compile(optimizer="adam", loss='SparseCategoricalCrossentropy', metrics=['sparse_categorical_accuracy'])
but same warning.
If it's just a warning it might be fine. Maybe upgrade or downgrade your libs (TF+Keras)
Do you get the same warning when you run my code? I'm not sure if this warning should be ignored. If I understand it correctly, it means that some of the gradients cannot be calculated, which means that some connections in the network are not connected correctly.
I've played a bit with the tf/keras versions, but the warning keeps coming up. However, I have received a more detailed warning:
"WARNING:tensorflow:Gradients do not exist for variables ['tcn_9/residual_block_0/matching_conv1D/kernel:0', 'tcn_9/residual_block_0/matching_conv1D/bias:0'] when minimizing the loss. If you're using model.compile()
, did you forget to provide a loss
argument?"
Another observation: If I add 2 dilation (so 2 convolution layers) the warnings disappear: ` # Modell.add( TCN(nb_filters=2, kernel_size=91, nb_stacks=1, dilations=[1], padding='causal',
Modell.add( TCN(nb_filters=2, kernel_size=91, nb_stacks=1, dilations=[1,2], padding='causal', use_skip_connections=True, dropout_rate=0.0, return_sequences=True, activation='relu') )
@ohilo12 that's interesting. I've never encountered this error but I haven't used the lib recently. It's probably better to add more than 1 dilation layer. The purpose of a TCN is to go do deep in this dimension. You might have encountered an edge case. But even though, I would not see why this warning happens.
What would be interesting: Does it only happens on my PC/environment? Can you try to run it, too?
Hello,
I am not sure if it is a bug or if I am doing something wrong. If I execute the code at the buttom I get the following warning: Gradients do not exist for variables ['kernel', 'bias'] when minimizing the loss. If using
model.compile()
, did you forget to provide aloss
argument? Does this error occurs in your environment, too?Versions: tf: 2.16.1 keras: 3.4.1 keras-tcn: 3.5.0