Quickstart: mantik CLI (docker)¶
Note
For this quickstart, we assume that you went through the First steps. For the next steps you need a mantik project with an experiment. We further assume that you have the following installed:
python >=3.9,<4.0
This section takes you through the steps needed to execute your first run by using mantik CLI. The aim of this tutorial is to provide a step-by-step guide that allows you to submit a run. In order to give you a kick-start, we provide tutorial code: https://gitlab.com/mantik-ai/tutorials.
You will learn the following:
Set up a local environment to use mantik.
Submit and bookkeep a run in a dockerized environment with mantik.
Build docker container for wine quality estimator project¶
As a first step, we build the docker container in which we are then executing the run. Clone the tutorial repository and build the relevant docker image named “wine-quality-executor”.
git clone https://gitlab.com/mantik-ai/tutorials.git
docker build -t wine-quality-executor tutorials/wine-quality-estimator/mlproject-docker
Bookkeep a run with mantik¶
We will start a run with mantik by using manik CLI. The run will be tracked by mantik and be visible as part of your mantik project on the mantik web page.
Install dependencies¶
For the rest, we will work in a terminal. Open a terminal. First install the mantik package as well as mlflow.
pip install mantik
pip install mlflow
Note
Mlflow is a framework for machine learning experiment tracking. mantik supports this framework. In the demo code provided, mlflow is used, however, more details are not needed for now. You can familiarize with mlflow later on.
Authentication with mantik¶
Define your mantik credentials.
export MANTIK_USERNAME=<MANTIK USERNAME>
export MANTIK_PASSWORD=<MANTIK PASSWORD>
Initialize your local mantik session.
eval $(mantik init)
Submit run with mantik¶
Define which project the run belongs to and from which git repository the code for the execution should be taken.
export MANTIK_PROJECT_ID="YOUR_PROJECT_ID"
export MANTIK_EXPERIMENT_REPOSITORY_ID="YOUR_EXPERIMENT_ID"
export MANTIK_CODE_REPOSITORY_ID="YOUR_CODE_REPOSITORY_ID"
The different IDs can be found in your mantik project.
Project ID:
Project -> Settings -> General
Experiment repository ID:
Project -> Experiments -> Details (Action column)
Code repository ID:
Project -> Experiments -> Details
With the following command you can submit a run. Note that the file “MLProjectDocker” is used to define the environment in which your machine learning code is executed in.
cd tutorials
mantik runs local "./wine-quality-estimator/mlproject-docker/MLProjectDocker" \
--name "Wine Quality Estimator Test Run" \
--branch main \
--parameter alpha=0.1
This will execute the project locally meaning on your machine. The run is bookkept in the mantik platform, so when navigating in the GUI to
Projects -> <PROJECT NAME> -> Runs -> Submissions
you will see the run.
In the run’s table navigate to the Details
view. Note that the used code repository and used infrastructure information is shown.
You have learned the basics on how to submit a run with mantik. In this demo you have used your machine as the infrastructure for your run. Note that you can submit a mantik run the same way on any other infrastructure where a docker image can be executed (e.g. local or in the cloud).