From dc6c8cfddce3d0898fd738f5d47700ef67f43b01 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sun, 25 Apr 2021 10:42:50 +0300 Subject: [PATCH] Add option to enable/disable tensorboard (default: enable) --- clearml/binding/frameworks/tensorflow_bind.py | 17 +++++++++-------- clearml/task.py | 11 ++++++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/clearml/binding/frameworks/tensorflow_bind.py b/clearml/binding/frameworks/tensorflow_bind.py index c854b159..efd6dcc8 100644 --- a/clearml/binding/frameworks/tensorflow_bind.py +++ b/clearml/binding/frameworks/tensorflow_bind.py @@ -11,7 +11,6 @@ from typing import Any import numpy as np import six from PIL import Image -from pathlib2 import Path from ...debugging.log import LoggerRoot from ..frameworks import _patched_call, WeightsFileHandler, _Empty @@ -27,15 +26,17 @@ except ImportError: class TensorflowBinding(object): @classmethod - def update_current_task(cls, task): + def update_current_task(cls, task, save_models, report_tensorboard): if not task: IsTensorboardInit.clear_tensorboard_used() - EventTrainsWriter.update_current_task(task) - PatchSummaryToEventTransformer.update_current_task(task) - PatchTensorFlowEager.update_current_task(task) - PatchKerasModelIO.update_current_task(task) - PatchTensorflowModelIO.update_current_task(task) - PatchTensorflow2ModelIO.update_current_task(task) + if report_tensorboard: + EventTrainsWriter.update_current_task(task) + PatchSummaryToEventTransformer.update_current_task(task) + PatchTensorFlowEager.update_current_task(task) + if save_models: + PatchKerasModelIO.update_current_task(task) + PatchTensorflowModelIO.update_current_task(task) + PatchTensorflow2ModelIO.update_current_task(task) class IsTensorboardInit(object): diff --git a/clearml/task.py b/clearml/task.py index 4acad105..1ae83103 100644 --- a/clearml/task.py +++ b/clearml/task.py @@ -354,7 +354,7 @@ class Task(_Task): .. code-block:: py - auto_connect_frameworks={'matplotlib': True, 'tensorflow': True, 'pytorch': True, + auto_connect_frameworks={'matplotlib': True, 'tensorflow': True, 'tensorboard': True, 'pytorch': True, 'xgboost': True, 'scikit': True, 'fastai': True, 'lightgbm': True, 'hydra': True} :param bool auto_resource_monitoring: Automatically create machine resource monitoring plots @@ -542,9 +542,14 @@ class Task(_Task): PatchedJoblib.update_current_task(task) if is_auto_connect_frameworks_bool or auto_connect_frameworks.get('matplotlib', True): PatchedMatplotlib.update_current_task(Task.__main_task) - if is_auto_connect_frameworks_bool or auto_connect_frameworks.get('tensorflow', True): + if is_auto_connect_frameworks_bool or auto_connect_frameworks.get('tensorflow', True) \ + or auto_connect_frameworks.get('tensorboard', True): PatchAbsl.update_current_task(Task.__main_task) - TensorflowBinding.update_current_task(task) + TensorflowBinding.update_current_task(task, + is_auto_connect_frameworks_bool or + auto_connect_frameworks.get('tensorflow', True), + is_auto_connect_frameworks_bool or + auto_connect_frameworks.get('tensorboard', True)) if is_auto_connect_frameworks_bool or auto_connect_frameworks.get('pytorch', True): PatchPyTorchModelIO.update_current_task(task) if is_auto_connect_frameworks_bool or auto_connect_frameworks.get('xgboost', True):