class_docstr: `ClearML <https://github.com/allegroai/clearml>`_ handler to log metrics, text, model/optimizer parameters,
  plots during training and validation.
  Also supports model checkpoints logging and upload to the storage solution of your choice (i.e. ClearML File server,
  S3 bucket etc.)
  
  .. code-block:: bash
  
      pip install clearml
      clearml-init
  
  Args:
      kwargs: Keyword arguments accepted from ``Task.init`` method.
          All arguments are optional. If a ClearML Task has already been created,
          kwargs will be ignored and the current ClearML Task will be used.
  
  Examples:
      .. code-block:: python
  
          from ignite.contrib.handlers.clearml_logger import *
  
          # Create a logger
  
          clearml_logger = ClearMLLogger(
              project_name="pytorch-ignite-integration",
              task_name="cnn-mnist"
          )
  
          # Attach the logger to the trainer to log training loss at each iteration
          clearml_logger.attach_output_handler(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              tag="training",
              output_transform=lambda loss: {"loss": loss}
          )
  
          # Attach the logger to the evaluator on the training dataset and log NLL, Accuracy metrics after each epoch
          # We setup `global_step_transform=global_step_from_engine(trainer)` to take the epoch
          # of the `trainer` instead of `train_evaluator`.
          clearml_logger.attach_output_handler(
              train_evaluator,
              event_name=Events.EPOCH_COMPLETED,
              tag="training",
              metric_names=["nll", "accuracy"],
              global_step_transform=global_step_from_engine(trainer),
          )
  
          # Attach the logger to the evaluator on the validation dataset and log NLL, Accuracy metrics after
          # each epoch. We setup `global_step_transform=global_step_from_engine(trainer)` to take the epoch of the
          # `trainer` instead of `evaluator`.
          clearml_logger.attach_output_handler(
              evaluator,
              event_name=Events.EPOCH_COMPLETED,
              tag="validation",
              metric_names=["nll", "accuracy"],
              global_step_transform=global_step_from_engine(trainer)),
          )
  
          # Attach the logger to the trainer to log optimizer's parameters, e.g. learning rate at each iteration
          clearml_logger.attach_opt_params_handler(
              trainer,
              event_name=Events.ITERATION_STARTED,
              optimizer=optimizer,
              param_name='lr'  # optional
          )
  
          # Attach the logger to the trainer to log model's weights norm after each iteration
          clearml_logger.attach(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              log_handler=WeightsScalarHandler(model)
          )
class_docstr_tok: ["`","ClearML","<","https",":","\/\/github.com\/allegroai\/clearml",">","`","_","handler","to","log","metrics",",","text",",","model\/optimizer","parameters",",","plots","during","training","and","validation",".","Also","supports","model","checkpoints","logging","and","upload","to","the","storage","solution","of","your","choice","(","i.e",".","ClearML","File","server",",","S3","bucket","etc",".",")","..","code-block",":",":","bash","pip","install","clearml","clearml-init","Args",":","kwargs",":","Keyword","arguments","accepted","from","``","Task.init","``","method",".","All","arguments","are","optional",".","If","a","ClearML","Task","has","already","been","created",",","kwargs","will","be","ignored","and","the","current","ClearML","Task","will","be","used",".","Examples",":","..","code-block",":",":","python","from","ignite.contrib.handlers.clearml_logger","import","*","#","Create","a","logger","clearml_logger","=","ClearMLLogger","(","project_name=","''","pytorch-ignite-integration","''",",","task_name=","''","cnn-mnist","''",")","#","Attach","the","logger","to","the","trainer","to","log","training","loss","at","each","iteration","clearml_logger.attach_output_handler","(","trainer",",","event_name=Events.ITERATION_COMPLETED",",","tag=","''","training","''",",","output_transform=lambda","loss",":","{","``","loss","''",":","loss","}",")","#","Attach","the","logger","to","the","evaluator","on","the","training","dataset","and","log","NLL",",","Accuracy","metrics","after","each","epoch","#","We","setup","`","global_step_transform=global_step_from_engine","(","trainer",")","`","to","take","the","epoch","#","of","the","`","trainer","`","instead","of","`","train_evaluator","`",".","clearml_logger.attach_output_handler","(","train_evaluator",",","event_name=Events.EPOCH_COMPLETED",",","tag=","''","training","''",",","metric_names=","[","``","nll","''",",","``","accuracy","''","]",",","global_step_transform=global_step_from_engine","(","trainer",")",",",")","#","Attach","the","logger","to","the","evaluator","on","the","validation","dataset","and","log","NLL",",","Accuracy","metrics","after","#","each","epoch",".","We","setup","`","global_step_transform=global_step_from_engine","(","trainer",")","`","to","take","the","epoch","of","the","#","`","trainer","`","instead","of","`","evaluator","`",".","clearml_logger.attach_output_handler","(","evaluator",",","event_name=Events.EPOCH_COMPLETED",",","tag=","''","validation","''",",","metric_names=","[","``","nll","''",",","``","accuracy","''","]",",","global_step_transform=global_step_from_engine","(","trainer",")",")",",",")","#","Attach","the","logger","to","the","trainer","to","log","optimizer","'s","parameters",",","e.g",".","learning","rate","at","each","iteration","clearml_logger.attach_opt_params_handler","(","trainer",",","event_name=Events.ITERATION_STARTED",",","optimizer=optimizer",",","param_name='lr","'","#","optional",")","#","Attach","the","logger","to","the","trainer","to","log","model","'s","weights","norm","after","each","iteration","clearml_logger.attach","(","trainer",",","event_name=Events.ITERATION_COMPLETED",",","log_handler=WeightsScalarHandler","(","model",")",")"]
docstr: Set ``clearml.Task`` to offline mode.
  Will bypass all outside communication, and will save all data and logs to a local session folder.
  Should only be used in "standalone mode", when there is no access to the *clearml-server*.
  
  Args:
      bypass: If ``True``, all outside communication is skipped.
          Data and logs will be stored in a local session folder.
          For more information, please refer to `ClearML docs
          <https://clear.ml/docs/latest/docs/clearml_sdk/task_sdk/#offline-mode>`_.
docstr_tok: ["Set","``","clearml.Task","``","to","offline","mode",".","Will","bypass","all","outside","communication",",","and","will","save","all","data","and","logs","to","a","local","session","folder",".","Should","only","be","used","in","``","standalone","mode","''",",","when","there","is","no","access","to","the","*","clearml-server","*",".","Args",":","bypass",":","If","``","True","``",",","all","outside","communication","is","skipped",".","Data","and","logs","will","be","stored","in","a","local","session","folder",".","For","more","information",",","please","refer","to","`","ClearML","docs","<","https",":","\/\/clear.ml\/docs\/latest\/docs\/clearml_sdk\/task_sdk\/","#","offline-mode",">","`","_","."]
code: def set_bypass_mode(cls, bypass: bool) -> None:
      """
      Set ``clearml.Task`` to offline mode.
      Will bypass all outside communication, and will save all data and logs to a local session folder.
      Should only be used in "standalone mode", when there is no access to the *clearml-server*.
  
      Args:
          bypass: If ``True``, all outside communication is skipped.
              Data and logs will be stored in a local session folder.
              For more information, please refer to `ClearML docs
              <https://clear.ml/docs/latest/docs/clearml_sdk/task_sdk/#offline-mode>`_.
      """
      from clearml import Task
  
      setattr(cls, "_bypass", bypass)
      Task.set_offline(offline_mode=bypass)
  
imports: import os
  import tempfile
  import warnings
  from collections import defaultdict
  from datetime import datetime
  from enum import Enum
  from typing import Any, Callable, DefaultDict, List, Mapping, Optional, Tuple, Type, Union
  from torch.optim import Optimizer
  import ignite.distributed
  from ignite.contrib.handlers.base_logger import BaseLogger, BaseOptimizerParamsHandler, BaseOutputHandler, BaseWeightsHandler, BaseWeightsScalarHandler
  from ignite.engine import Engine, Events
  from ignite.handlers import global_step_from_engine
  from ignite.handlers.checkpoint import DiskSaver
label_desc: Use image node_id 2 for calling the ClearMLLogger obj's underlying member method code with example usage: obj.set_bypass_mode(cls, bypass) without return types