I am logging the model using
mlflow.sklearn.log_model(model, "my-model")
and I want to set tags to the model during logging, I checked that this method does not allow to set tags, there is a mlflow.set_tags() method but it is tagging the run not the model.
Does anyone know how to tag the model during logging?
Thank you!
When using
mlflow.sklearn.log_modelyou work with the experiment registry which is run-focused so only experiments and runs can be described and tagged.If you want to set tags on models, you need to work with the model registry.
The solution I would recommend is to register the model when logging using
registered_model_name(there are more fine-grained ways, too) and useMLFlowClientAPI to set custom properties (like tags) of the already registered model.Here is a working example:
Here is the illustration
See also this excellent documentation of MLFlow Client.