tensorflow / profiler

A profiling and performance analysis tool for TensorFlow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'TrackableWeightHandler' object has no attribute 'name'

DachuanZhao opened this issue · comments

Maybe the same issue
Here is the colab

When use both tensorboard and tf.keras.layers.experimental.preprocessing'layer , It raises error :

Epoch 1/30
29/29 [==============================] - 2s 36ms/step - loss: 0.7386 - accuracy: 0.3677 - val_loss: 0.5674 - val_accuracy: 0.7161
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-23-0cc1578a967d> in <module>()
      3     epochs=30,
      4     validation_data=val_ds,
----> 5     callbacks = [tf.keras.callbacks.EarlyStopping(verbose=1,restore_best_weights=True),tf.keras.callbacks.TensorBoard("logs",histogram_freq=1,update_freq='batch')]
      6 )

3 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1143           epoch_logs.update(val_logs)
   1144 
-> 1145         callbacks.on_epoch_end(epoch, epoch_logs)
   1146         training_logs = epoch_logs
   1147         if self.stop_training:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/callbacks.py in on_epoch_end(self, epoch, logs)
    426     for callback in self.callbacks:
    427       if getattr(callback, '_supports_tf_logs', False):
--> 428         callback.on_epoch_end(epoch, logs)
    429       else:
    430         if numpy_logs is None:  # Only convert once.

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/callbacks.py in on_epoch_end(self, epoch, logs)
   2337 
   2338     if self.histogram_freq and epoch % self.histogram_freq == 0:
-> 2339       self._log_weights(epoch)
   2340 
   2341     if self.embeddings_freq and epoch % self.embeddings_freq == 0:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/callbacks.py in _log_weights(self, epoch)
   2395         for layer in self.model.layers:
   2396           for weight in layer.weights:
-> 2397             weight_name = weight.name.replace(':', '_')
   2398             summary_ops_v2.histogram(weight_name, weight, step=epoch)
   2399             if self.write_images:

AttributeError: 'TrackableWeightHandler' object has no attribute 'name'

This issue doesn't seem to relate to TensorFlow profiler. I think you can file the issue to TensorBoard:
https://github.com/tensorflow/tensorboard/issues

@qiuminxu @DachuanZhao did you ever find out the cause of this issue?