Skip to content

Mlflow integration callback#8016

Merged
LysandreJik merged 15 commits intohuggingface:masterfrom
noise-field:mlflow-integration-callback
Oct 26, 2020
Merged

Mlflow integration callback#8016
LysandreJik merged 15 commits intohuggingface:masterfrom
noise-field:mlflow-integration-callback

Conversation

@noise-field
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds Trainer integration with MLflow.

It is implemented in roughly the same way as other integration callbacks (CometML, wandb) and gets added to the list of Trainer callbacks automatically when mlflow is installed. All the mlflow parameters are configured with env variables, as described in the library documentation. This PR adds an additional environment variable, HF_MLFLOW_LOG_ARTIFACTS, which controls whether to use mlflow artifact logging facility to save artifacts generated after training (it doesn't make much sense if mlflow is used locally).

Fixes #7698

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to the it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@sgugger

Add integration code for MLflow in integrations.py along with the code
that checks that MLflow is installed.
Add import of MLflowCallback in trainer.py
Allow the callback to handle model argument and store model config items as hyperparameters.
MLflow cannot log more than a hundred parameters at once.
Code added to split the parameters into batches of 100 items and log the batches one by one.
The "fluent" api used in MLflow integration allows only one run to be active at any given moment. If the Trainer is disposed off and a new one is created, but the training is not finished, it will refuse to log the results when the next trainer is created.
Add integration code for MLflow in integrations.py along with the code
that checks that MLflow is installed.
Add import of MLflowCallback in trainer.py
Allow the callback to handle model argument and store model config items as hyperparameters.
MLflow cannot log more than a hundred parameters at once.
Code added to split the parameters into batches of 100 items and log the batches one by one.
The "fluent" api used in MLflow integration allows only one run to be active at any given moment. If the Trainer is disposed off and a new one is created, but the training is not finished, it will refuse to log the results when the next trainer is created.
Copy link
Copy Markdown
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very clean, thanks a lot for this PR!

@sgugger sgugger requested a review from LysandreJik October 26, 2020 12:15
Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@LysandreJik LysandreJik merged commit c48b16b into huggingface:master Oct 26, 2020
@noise-field noise-field deleted the mlflow-integration-callback branch October 26, 2020 21:00
@dmilcevski dmilcevski mentioned this pull request Mar 24, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLflow Trainer Callback

3 participants