Skip to main content

How to Read the MLmodel File of an MLflow Model

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

Every MLflow model comes with a small YAML file named MLmodel. It's the model's label: how to load it, in which format it's stored, which run made it, what input it takes. Every MLflow tool reads it before touching the model. This guide reads one, in the UI and from Python with mlflow.models.get_model_info, with a real file from MLflow 3.18.0.

Syntax​

Syntax
model_info = mlflow.models.get_model_info(model_uri)
PartWhat it means
model_uriWhere the model is, such as models:/<model ID>
model_infoThe MLmodel file's contents as an object: flavors, model_id, run_id, signature, utc_time_created, mlflow_version and more

MLflow's reference: it gets "metadata for the specified model, such as its input/output signature".

Prerequisites​

  • An MLflow tracking server at http://127.0.0.1:8080. MLflow's tracking server guide shows how to start one.
  • mlflow and scikit-learn in your project, for example with uv add mlflow scikit-learn pandas.

Step 1: Log a Model to Read​

Any logged model will do. This script logs a linear regression on scikit-learn's diabetes data, with an input example, into the experiment named on the command line, and prints its URI:

log_diabetes_model.py
import sys

import mlflow
from sklearn.datasets import load_diabetes
from sklearn.linear_model import LinearRegression

mlflow.set_tracking_uri("http://127.0.0.1:8080")
mlflow.set_experiment(sys.argv[1])

X, y = load_diabetes(return_X_y=True, as_frame=True)
model = LinearRegression().fit(X, y)

with mlflow.start_run():
model_info = mlflow.sklearn.log_model(model, name="diabetes-model", input_example=X.head(3))

print("Model URI:", model_info.model_uri)
Terminal
uv run python log_diabetes_model.py mlmodel-demo
Output (last lines)
🏃 View run persistent-carp-423 at: http://127.0.0.1:8080/#/experiments/11/runs/2a5a417427114f9fadc4b3cdc1587ed0
🧪 View experiment at: http://127.0.0.1:8080/#/experiments/11
Model URI: models:/m-5ad4afaee36c496cab22b7d59a8b6991

Step 2: Open MLmodel in the UI​

Open the experiment's Models tab, click the model, then Artifacts and MLmodel:

The model's Artifacts tab with MLmodel open: the file list shows MLmodel, conda.yaml, input_example.json, model.skops, python_env.yaml, requirements.txt and serving_input_example.json, and the file shows the flavors, the format, the IDs and the saved input example's details.

The whole file:

MLmodel
artifact_path: mlflow-artifacts:/11/models/m-5ad4afaee36c496cab22b7d59a8b6991/artifacts
flavors:
python_function:
env:
conda: conda.yaml
virtualenv: python_env.yaml
loader_module: mlflow.sklearn
model_path: model.skops
predict_fn: predict
python_version: 3.15.2
sklearn:
code: null
pickled_model: model.skops
serialization_format: skops
sklearn_version: 1.9.1
skops_trusted_types: null
is_signature_from_type_hint: false
mlflow_version: 3.18.0
model_id: m-5ad4afaee36c496cab22b7d59a8b6991
model_size_bytes: 10739
model_uuid: m-5ad4afaee36c496cab22b7d59a8b6991
prompts: null
run_id: 2a5a417427114f9fadc4b3cdc1587ed0
saved_input_example_info:
artifact_path: input_example.json
pandas_orient: split
serving_input_path: serving_input_example.json
type: dataframe
signature:
inputs: '[{"type": "double", "name": "age", "required": true}, {"type": "double",
"name": "sex", "required": true}, {"type": "double", "name": "bmi", "required":
true}, {"type": "double", "name": "bp", "required": true}, {"type": "double",
"name": "s1", "required": true}, {"type": "double", "name": "s2", "required":
true}, {"type": "double", "name": "s3", "required": true}, {"type": "double",
"name": "s4", "required": true}, {"type": "double", "name": "s5", "required":
true}, {"type": "double", "name": "s6", "required": true}]'
outputs: '[{"type": "double", "required": true}]'
params: null
type_hint_from_example: false
utc_time_created: '2026-11-21 08:42:52.534435'

Read it top to bottom:

  • flavors: the ways the model can be loaded. MLflow's guide calls flavors "the key concept that makes MLflow Models powerful". python_function is the generic one any MLflow tool can use: it names the loader_module (mlflow.sklearn), the file (model.skops), the function predict calls (predict_fn), and the environment files. sklearn loads it back as the scikit-learn model itself, and records the format and scikit-learn's version.
  • model_id, run_id: which logged model this is, and the run that logged it.
  • model_size_bytes: the model's size, here about 10 KB.
  • saved_input_example_info: where the input example is, and in which layout.
  • signature: the input columns and their types, and the output.
  • utc_time_created, mlflow_version: when, and with which MLflow, it was saved.

Step 3: Read It from Python​

get_model_info reads the same file without downloading the model:

The read_mlmodel.py script in a macOS-style code window: it calls mlflow.models.get_model_info with the model URI from the command line and prints the flavors, model ID, run ID, creation time, MLflow version and signature.

read_mlmodel.py
import sys

import mlflow

mlflow.set_tracking_uri("http://127.0.0.1:8080")

model_info = mlflow.models.get_model_info(sys.argv[1])
print("Flavors: ", list(model_info.flavors))
print("Model ID:", model_info.model_id)
print("Run ID: ", model_info.run_id)
print("Created: ", model_info.utc_time_created)
print("MLflow: ", model_info.mlflow_version)
print("Signature:")
print(model_info.signature)
Terminal
uv run python read_mlmodel.py models:/m-5ad4afaee36c496cab22b7d59a8b6991
Output
Flavors: ['python_function', 'sklearn']
Model ID: m-5ad4afaee36c496cab22b7d59a8b6991
Run ID: 2a5a417427114f9fadc4b3cdc1587ed0
Created: 2026-11-21 08:42:52.534435
MLflow: 3.18.0
Signature:
inputs:
['age': double (required), 'sex': double (required), 'bmi': double (required), 'bp': double (required), 's1': double (required), 's2': double (required), 's3': double (required), 's4': double (required), 's5': double (required), 's6': double (required)]
outputs:
[double (required)]
params:
None

The output of read_mlmodel.py in a terminal: the flavors python_function and sklearn, the model and run IDs, the creation time, MLflow 3.18.0 and the signature with ten double inputs and one double output.

The same facts as the file, as Python values you can check in code, for example to refuse a model without a signature.

Common Mistakes​

MistakeWhat happensDo this instead
Downloading the whole model to check its signatureSlow for big modelsget_model_info, which downloads only MLmodel
Telling models apart by model_size_bytesModels trained the same way have the same size: three such models here are all 10739 bytesUse model_id

Troubleshooting​

SymptomLikely causeFix
No signature sectionThe model was logged without a signature or input exampleAdd a signature when logging
No saved_input_example_infoLogged without input_exampleAdd an input example

FAQ​

Is utc_time_created in my time zone?​

No: as its name says, it's in UTC.

What is model_uuid?​

In this file it's the same value as model_id.

Conclusion​

The MLmodel file told how to load the model (two flavors, the skops file, predict), which run made it, its size, its input example and its signature. The UI's Artifacts tab shows it; mlflow.models.get_model_info gives it to your code.

Additional Resources​