mlflow_io
Serializer and deserializer for MLflow supported model flavors. Only include annotated modules at this time.
- sklearn
- prophet
- tensorflow (need update current annotation)
- keras (need update current annotation)
- h2o
- gluon
- xgboost
- lightgbm
- catboost
- spacy
- fastai
- statsmodels
mlflow_io = {}
module-attribute
This dictionary holds information about how to serialize and deserialize for
each MLflow supported model flavors. Each individual key is a module name;
i.e., MLflow supported flavor, sklearn
for instance. Each value is a
dictionary with following three keys:
- class: list of object class with the module that can be log/save in MLflow
- serializer: the method in MLflow to log the model flavor
- deserializer is the method in MLflow to retrieve the model
read_mlflow(mlflow_metadata)
Read model from MLflow artifact store
In case the saved tracking_uri or the registry_uri is different from lineapy configs(i.e., multiple MLflow backends), we recored current lineapy related mlflow configs for tracking/registry and set tracking/registry based on metadata to load the model and reset back to the original configs.
Source code in lineapy/plugins/serializers/mlflow_io.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
try_write_to_mlflow(value, name, **kwargs)
Try to save artifact with MLflow. If success return mlflow ModelInfo, return None if fail.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Any
|
value(ML model) to save with mlflow |
required |
name |
str
|
artifact_path and registered_model_name used in
|
required |
**kwargs |
args to pass into |
{}
|
Returns:
Type | Description |
---|---|
Optional[Any]
|
return a ModelInfo(MLflow model metadata) if successfully save with mlflow; otherwise None. Note that, using Any not ModelInfo here in case mlflow is not installed and cause error when loading lineapy |
Source code in lineapy/plugins/serializers/mlflow_io.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|