New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensorflow version 2.16.1 has retracing problem for keras.model.train_on_batch(). #67033
Comments
Hi @garryyan2 , The warning will arise when we call a function multiple times (for eg in a loop) that is decorated with tf.function decorator. Since retracing is computationally expensive this will affect performance but the model will not have any issue wrt its metrics or predictions except time complexity increases. You can check the info in warning and take necessary steps. Also you can pass However provided code snippet I can't see any tf.function decorator being used. I can't reproduce the issue either due to missing dependencies as per gist. |
Thank you very much for looking into the problem. I am sorry that the code will not run. Now, I have tried out the updated code in colab as in here. It should run. The code runs without any issues. The reason is that colab is still in version 2.15.1. The problem is not the warning in Tensorflow version 2.16.1. The problem is the code runs about 100 times slower in the new version. I want to used the new version because that is the version that I am able to have both CUDA/cuDNN and tensorflow installed in order to run the code in GPU. |
Hi @garryyan2 , I can't access the attached colab of your's. Please submit the same. Please confirm you have installed |
Here is the code: import os class trn_sizes:
trn_sizes = trn_sizes() class inputBatch(object, ):
def create_model(trn_sizes):
FLAGS = None def main(FLAGS):
main(FLAGS) Yes, tensorflow is installed with [and-cuda]. The GPU is detected. Thank you for your help. |
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No
Source
binary
TensorFlow version
2,16,1
Custom code
No
OS platform and distribution
windows 10
Mobile device
No response
Python version
3.11
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
The problem happens in both windows and WSL (Ubuntu )operating system. Tensorflow 2.15.1 and earlier versions don't have the problem. The warning messages will be given after the train_on_batch() is called 5 and 6 times. The function is about 100 times slower in Tensorflow 2.16.1 in comparison to earlier versions.
Standalone code to reproduce the issue
Relevant log output
The text was updated successfully, but these errors were encountered: