Skip to content

Commit

Permalink
Add MLFlow as a logger option (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspfohl authored Aug 7, 2023
1 parent 358e064 commit ad6545c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion llmfoundry/utils/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from composer.core import Evaluator
from composer.datasets.in_context_learning_evaluation import \
get_icl_task_dataloader
from composer.loggers import TensorboardLogger, WandBLogger
from composer.loggers import MLFlowLogger, TensorboardLogger, WandBLogger
from composer.optim import DecoupledAdamW
from composer.optim.scheduler import (ConstantWithWarmupScheduler,
CosineAnnealingWithWarmupScheduler,
Expand Down Expand Up @@ -67,6 +67,8 @@ def build_logger(name: str, kwargs: Dict[str, Any]):
return WandBLogger(**kwargs)
elif name == 'tensorboard':
return TensorboardLogger(**kwargs)
elif name == 'mlflow':
return MLFlowLogger(**kwargs)
else:
raise ValueError(f'Not sure how to build logger: {name}')

Expand Down
8 changes: 8 additions & 0 deletions llmfoundry/utils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,11 @@ def log_config(cfg: DictConfig):
raise e
if wandb.run:
wandb.config.update(om.to_container(cfg, resolve=True))

if 'mlflow' in cfg.get('loggers', {}):
try:
import mlflow
except ImportError as e:
raise e
if mlflow.active_run():
mlflow.log_params(params=om.to_container(cfg, resolve=True))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
]

install_requires = [
'mosaicml[libcloud,nlp,wandb]>=0.15.0,<0.16',
'mosaicml[libcloud,nlp,wandb,mlflow]>=0.15.0,<0.16',
'accelerate>=0.20,<0.21', # for HF inference `device_map`
'mosaicml-streaming>=0.5.1,<0.6',
'torch>=1.13.1,<=2.0.1',
Expand Down

0 comments on commit ad6545c

Please sign in to comment.