tensorflow: Cannot use dictionary embeddings metadata for keras callbacks
Using dictionary as embeddings_metadata does not seem to be handled correctly in the Keras callbacks v2.
Indeed, while trying to do so I get the following error message:
ValueError: Unrecognized `Embedding` layer names passed to `keras.callbacks.TensorBoard` `embeddings_metadata` argument: dict_keys(['embedding_1', 'embedding_2'])
After looking at the source code (see here), I figured that, when the metadata is not a string, it checked if the layer names was in embedding.metadata_path
. However, this variable is never set in this case and it is an empty string by default.
Looking at how it is handled in the v1, I think the check should be done on self.embeddings_metadata
(assuming if it is not a string it is a dictionary). So
if layer.name in embedding.metadata_path:
should be something like
if layer.name in self.embeddings_metadata:
Maybe it should be a copy of this dictionary or there should be a test to check that this is indeed a dictionary.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (7 by maintainers)
@rchao would love to get your feedback on this issue