Skip to content

Commit e6d1863

Browse files
Freshness, in progress.
1 parent 20a4e39 commit e6d1863

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

articles/machine-learning/how-to-convert-custom-model-to-mlflow.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ ms.custom: devx-track-python, mlflow
1717

1818
In this article, learn how to convert your custom ML model into MLflow format. [MLflow](https://www.mlflow.org) is an open-source library for managing the lifecycle of your machine learning experiments. In some cases, you might use a machine learning framework without its built-in MLflow model flavor support. Due to this lack of built-in MLflow model flavor, you cannot log or register the model with MLflow model fluent APIs. To resolve this, you can convert your model to an MLflow format where you can leverage the following benefits of Azure Machine Learning and MLflow models.
1919

20-
With Azure Machine Learning, MLflow models get the added benefits of,
20+
With Azure Machine Learning, MLflow models get the added benefits of:
2121

22-
* No code deployment
23-
* Portability as an open source standard format
24-
* Ability to deploy both locally and on cloud
22+
- No code deployment
23+
- Portability as an open source standard format
24+
- Ability to deploy both locally and on cloud
2525

26-
MLflow provides support for a variety of [machine learning frameworks](https://mlflow.org/docs/latest/models.html#built-in-model-flavors) (scikit-learn, Keras, Pytorch, and more); however, it might not cover every use case. For example, you may want to create an MLflow model with a framework that MLflow does not natively support or you may want to change the way your model does pre-processing or post-processing when running jobs. To know more about MLflow models read [From artifacts to models in MLflow](concept-mlflow-models.md).
26+
MLflow provides support for a variety of [machine learning frameworks](https://mlflow.org/docs/latest/models.html#built-in-model-flavors) (scikit-learn, Keras, Pytorch, and more); however, it might not cover every use case. For example, you may want to create an MLflow model with a framework that MLflow does not natively support or you may want to change the way your model does pre-processing or post-processing when running jobs. To learn more about MLflow models see [From artifacts to models in MLflow](concept-mlflow-models.md).
2727

28-
If you didn't train your model with MLFlow and want to use Azure Machine Learning's MLflow no-code deployment offering, you need to convert your custom model to MLFLow. Learn more about [custom Python models and MLflow](https://mlflow.org/docs/latest/models.html#custom-python-models).
28+
If you didn't train your model with MLFlow and want to use Azure Machine Learning's MLflow no-code deployment offering, you need to convert your custom model to MLFLow. For more information, see [Custom Python Models](https://mlflow.org/docs/latest/models.html#custom-python-models).
2929

3030
## Prerequisites
31-
31+
3232
Only the mlflow package installed is needed to convert your custom models to an MLflow format.
3333

3434
## Create a Python wrapper for your model
@@ -92,12 +92,11 @@ conda_env = {
9292

9393
## Load the MLFlow formatted model and test predictions
9494

95-
Once your environment is ready, you can pass the SKlearnWrapper, the Conda environment, and your newly created artifacts dictionary to the mlflow.pyfunc.save_model() method. Doing so saves the model to your disk.
95+
After your environment is ready, you can pass the SKlearnWrapper, the Conda environment, and your newly created artifacts dictionary to the `mlflow.pyfunc.save_model()` method. Doing so saves the model to your disk.
9696

9797
```python
9898
mlflow_pyfunc_model_path = "sklearn_mlflow_pyfunc_custom"
9999
mlflow.pyfunc.save_model(path=mlflow_pyfunc_model_path, python_model=SKLearnWrapper(), conda_env=conda_env, artifacts=artifacts)
100-
101100
```
102101

103102
To ensure your newly saved MLflow formatted model didn't change during the save, you can load your model and print out a test prediction to compare your original model.
@@ -122,7 +121,7 @@ print(result)
122121

123122
## Register the MLflow formatted model
124123

125-
Once you've confirmed that your model saved correctly, you can create a test run, so you can register and save your MLflow formatted model to your model registry.
124+
After you confirm that your model saved correctly, you can create a test run, so you can register and save your MLflow formatted model to your model registry.
126125

127126
```python
128127

@@ -140,9 +139,9 @@ mlflow.end_run()
140139
```
141140

142141
> [!IMPORTANT]
143-
> In some cases, you might use a machine learning framework without its built-in MLflow model flavor support. For instance, the `vaderSentiment` library is a standard natural language processing (NLP) library used for sentiment analysis. Since it lacks a built-in MLflow model flavor, you cannot log or register the model with MLflow model fluent APIs. See an example on [how to save, log and register a model that doesn't have a supported built-in MLflow model flavor](https://mlflow.org/docs/latest/model-registry.html#registering-an-unsupported-machine-learning-model).
142+
> In some cases, you might use a machine learning framework without its built-in MLflow model flavor support. For instance, the `vaderSentiment` library is a standard natural language processing (NLP) library used for sentiment analysis. Since it lacks a built-in MLflow model flavor, you cannot log or register the model with MLflow model fluent APIs. For an example on how to save, log and register a model that doesn't have a supported built-in MLflow model flavor, see [Registering an Unsupported Machine Learning Model](https://mlflow.org/docs/latest/model-registry.html#registering-an-unsupported-machine-learning-model).
144143
145144
## Next steps
146145

147-
* [No-code deployment for Mlflow models](how-to-deploy-mlflow-models-online-endpoints.md)
148-
* Learn more about [MLflow and Azure Machine Learning](concept-mlflow.md)
146+
- [Deploy MLflow models to online endpoints](how-to-deploy-mlflow-models-online-endpoints.md)
147+
- [MLflow and Azure Machine Learning](concept-mlflow.md)

0 commit comments

Comments
 (0)