kiwi.loggers
MLFlowTrackingLogger
Log using MLflow. Install it with pip:
normalize_metric_key(key)
normalize_metric_key
Normalize key name for MLflow.
validate_metric_value(value)
validate_metric_value
kiwi.loggers.
logger
_INVALID_PARAM_AND_METRIC_CHARACTERS
mlflow.exceptions.MlflowException: Invalid metric name: ‘WMT19_F1_MULT+PEARSON’. Names may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/).
This is raised by matching against r"^[/\w.\- ]*$".
r"^[/\w.\- ]*$"
Bases: pytorch_lightning.loggers.MLFlowLogger
pytorch_lightning.loggers.MLFlowLogger
pip install mlflow
Example
>>> from pytorch_lightning import Trainer >>> from pytorch_lightning.loggers import MLFlowLogger >>> mlf_logger = MLFlowLogger( ... experiment_name="default", ... tracking_uri="file:./ml-runs" ... ) >>> trainer = Trainer(logger=mlf_logger)
Use the logger anywhere in you LightningModule as follows:
LightningModule
>>> from pytorch_lightning import LightningModule >>> class LitModel(LightningModule): ... def training_step(self, batch, batch_idx): ... # example ... self.logger.experiment.whatever_ml_flow_supports(...) ... ... def any_lightning_module_function_or_hook(self): ... self.logger.experiment.whatever_ml_flow_supports(...)
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.
tracking_uri
log_param
log_hyperparams
Record hyperparameters.
params – Namespace containing the hyperparameters
Namespace
log_metrics
Records metrics. This method logs metrics as as soon as it received them. If you want to aggregate metrics for one specific step, use the agg_and_log_metrics() method.
agg_and_log_metrics()
metrics – Dictionary with metric names as keys and measured quantities as values
step – Step number at which the metrics should be recorded
log_artifact
log_artifacts
get_artifact_uri
log_model
log_tag
log_tags
kiwi.constants
kiwi.runner