I've been trying to profile a predict call of a custom NN model using a Cloud TPU v2-8 Node.
It is important to say that my prediction call takes about 2 minutes to finish and I do it using data divided in TFRecord batches.
I followed the official documentation "Profile your model with Cloud TPU Tools" and I tryied to capture a profile:
- Using Tensorboard UI and
- The "programatic way" with a tf.profiler.experimental.start() and tf.profilier.experimental.stop() wrapping the predict call, but I had no success in both cases.
# TPU Node connection is done before...
# TPU at this point is already running
logdir_path = "logs/predict"
tf.profiler.experimental.start(logdir_path)
# Tensorflow predict call here
tf.profiler.experimental.stop()
I could generate some data in both cases (Tensorboard UI and profiler call), but when I try to open it in Tensorboard pointing the logdir path, I received a "No dashboard are active for the current data set" message.
Is there any way to profile a Tensorflow/Keras prediction call with a model running in a Cloud TPU Node?
Curious fact - There seems to be an inconsistency in the Tensorflow docs and Cloud TPU docs: in Tensorflow Optimization Docs we can see that tf.profiler.experimental.start/stop calls are not supported by TPU hardware, but in Google Cloud docs this is the recommended method to capture a profile in TPU.
Config:
- Tensorflow 2.6.1
- Tensorboard 2.9.1
- Python 3.8
- Cloud TPU Node v2-8