From 569ab6610d32b2e00a8c56561357862fa357a460 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 25 Aug 2021 16:47:11 +0300 Subject: [PATCH] Fix Tensorflow add_image with description='text' --- clearml/binding/frameworks/tensorflow_bind.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clearml/binding/frameworks/tensorflow_bind.py b/clearml/binding/frameworks/tensorflow_bind.py index 3b94f943..abea1957 100644 --- a/clearml/binding/frameworks/tensorflow_bind.py +++ b/clearml/binding/frameworks/tensorflow_bind.py @@ -1254,20 +1254,22 @@ class PatchTensorFlowEager(object): # noinspection PyBroadException try: plugin_type = summary_metadata.decode() - if plugin_type.endswith('scalars'): + # remove any none alpha numeric value + plugin_type = plugin_type[next(i for i, c in enumerate(plugin_type) if c >= 'A'):] + if plugin_type.startswith('scalars'): event_writer._add_scalar(tag=str(tag), step=int(step.numpy()) if not isinstance(step, int) else step, scalar_data=tensor.numpy()) - elif plugin_type.endswith('images'): + elif plugin_type.startswith('images'): img_data_np = tensor.numpy() PatchTensorFlowEager._add_image_event_helper(event_writer, img_data_np=img_data_np, tag=tag, step=step, **kwargs) - elif plugin_type.endswith('histograms'): + elif plugin_type.startswith('histograms'): event_writer._add_histogram( tag=str(tag), step=int(step.numpy()) if not isinstance(step, int) else step, hist_data=tensor.numpy() ) - elif plugin_type.endswith('text'): + elif plugin_type.startswith('text'): event_writer._add_text( tag=str(tag), step=int(step.numpy()) if not isinstance(step, int) else step, tensor_bytes=tensor.numpy()