Using MLFlow
MLflow is an open-source platform for managing the machine learning lifecycle. It mainly focuses on the following four aspects:
  • Tracking
  • Projects
  • Models
  • Model Registry
You can use MLFlow in conjunction with Neu.ro to prepare efficient ML pipelines.
We have created a repository with a project that can help you quickly check how this works.

Connecting MLFlow and Neu.ro

First, you will need to create a folder in your project's volumes section that will serve as a store for artifacts and SQLite data. Here, we'll name it mlruns:
1
mlruns:
2
remote: storage:${{ flow.flow_id }}/mlruns
3
mount: /usr/local/share/mlruns
Copied!
Then, add the mlflow action in the jobs section. This will allow you to run MLFlow in your project by triggering the Github action from our repository without the need to configure it manually.
1
mlflow:
2
action: gh:neuro-actions/[email protected]
3
args:
4
backend_store_uri: sqlite:///${{ volumes.mlruns.mount }}/mlflow.db
5
default_artifact_root: ${{ volumes.mlruns.mount }}
6
volumes: "${{ to_json( [volumes.mlruns.ref_rw] ) }}"
Copied!
Now mount the newly created volume (mlruns in this case) in the volumes section of the train job's description:
1
volumes:
2
- $[[ upload(volumes.data).ref_ro ]]
3
- $[[ upload(volumes.code).ref_ro ]]
4
- $[[ volumes.mlruns.ref_rw ]]
Copied!
You can now pass the MLFLow URI to the training script and parse it to integrate your script execution with MLFlow running on our platform. Just add the following in the bash section of the train job's description:
1
--mlflow_uri http://${{ inspect_job('mlflow').internal_hostname_named }}:5000 \
Copied!
Use the following code to parse the new mlflow_uri argument:
1
parser.add_argument(
2
'--mlflow_uri',
3
type=str,
4
default='http//localhost:5000',
5
help='Mlflow URI.'
6
)
Copied!
After this, you can start using MLFlow's functionality in your project's script.