Loggers

TorchOk supports all loggers from PyTorch Lightning as well as some customized loggers.

Customized loggers

class torchok.constructor.logger.MLFlowLoggerX(experiment_name: str = 'default', run_name: Optional[str] = None, tracking_uri: Optional[str] = None, tags: Optional[Dict[str, Any]] = None, save_dir: Optional[str] = './mlruns', prefix: str = '', artifact_location: Optional[str] = None, run_id: Optional[int] = None)

Bases: MLFlowLogger

This logger completely repeats the functionality of Pytorch Lightning MLFlowLogger. But unlike the Lightning logger it uploads *.onnx and *.ckpt artifacts to artifact_location path.

Parameters
  • experiment_name – The name of the experiment

  • tracking_uri – Address of local or remote tracking server. If not provided, defaults to file:<save_dir>.

  • tags – A dictionary tags for the experiment.

  • save_dir – A path to a local directory where the MLflow runs get saved. Defaults to ./mlflow if tracking_uri is not provided. Has no effect if tracking_uri is provided.

  • prefix – A string to put at the beginning of metric keys.

  • artifact_location – The location to store run artifacts. If not provided, the server picks an appropriate default.

  • run_id – The run identifier of the experiment. If not provided, a new run is started.

Raises

ImportError – If required MLFlow package is not installed on the device.

__init__(experiment_name: str = 'default', run_name: Optional[str] = None, tracking_uri: Optional[str] = None, tags: Optional[Dict[str, Any]] = None, save_dir: Optional[str] = './mlruns', prefix: str = '', artifact_location: Optional[str] = None, run_id: Optional[int] = None)
finalize(status: str = 'FINISHED')

Call finalize of pytorch lightning MlFlowLogger and logs *.ckpt and *.onnx artifacts in artifact_location.

Parameters

status – A string value of mlflow.entities.RunStatus. Defaults to “FINISHED”.

log_hyperparams(params: Union[Dict[str, Any], Namespace]) None