CLI-driven Workflow
In this document, we will cover the common tasks involved in building a machine learning model and guide how you can use our CLI commands to accomplish these tasks:
Build a baseline machine learning model with Experiments.
Optimize hyperparameters using Sweep.
Update and store models on Model registry.
Here, we will use the MNIST database to create an image classification model. All our CLI commands are one-liners but you can also select from command option prompts.
Requirements
To follow this guide, you should first have the following setup.
Organization — a dedicated organization for you or your team
Project — a space for your machine learning model and mounted datasets
VESSL Client — Python SDK and CLI to manage ML workflows and resources on VESSL
If you have not created an Organization or a Project, first follow the instructions on the end-to-end guides.
1. Experiment — Build a baseline model
1-1. Configure your default organization and project
Let's start by configuring the client with the default organization and project we have created earlier. This is done by executing vessl configure.
vessl configure \
--organization "YOUR_ORGANIZATION_NAME" \
--project "YOUR_PROJECT_NAME"vessl configure
Please grant CLI access from the URL below.
https://vessl.ai/cli/grant-access?token=o0dyb21eu8fw
Waiting...
[?] Default organization: YOUR_ORGANIZATION_NAME
> YOUR_ORGANIZATION_NAME
[?] Default project: YOUR_PROJECT_NAME
> YOUR_PROJECT_NAME
You also can check and re-configure your default organization and project by specifying options after vessl configure.
1-2. Create and mount a dataset
To create a dataset on VESSL, run vessl dataset create. Let's create a dataset from the public AWS S3 dataset we have prepared: s3://savvihub-public-apne2/mnist. You can check that your dataset was created successfully by clicking the output link.

1-3. Create a machine learning experiment
To create an experiment, use vessl experiment create. Let's run an experiment using VESSL's managed clusters. First, specify the cluster and resources options. Then, specify the image URL — in this case, we are pulling a Docker image from VESSL's Amazon ECR Public Gallery. Next, we are going to mount the dataset we have created previously. Finally, let's specify the start command that will be executed in the experiment container. Here, we will use the MNIST Keras example from our GitHub repository.

Note that you can also integrate a GitHub repository with your project so you don't have to git clone every time you create an experiment. For more information about these features, please refer to our doc's project repository & project dataset page.
1-4. View experiment results
The experiment may take a few minutes to complete. You can get the details of the experiment, including its status, using vessl experiment read or by clicking the output link.

1-5. Create a model
In VESSL, you can create a model from a completed experiment. First, let's start by creating a model repository using vessl model-repository create and specifying the repository name.

Then, let's get a list of experiments in the project and their experiment ID.

Finally, run vessl model create with options including the destination repository and experiment ID. Make sure that the option value for --experiment-id is an integer, not a string.

You can see that the model has been created successfully by specifying the repository name and selecting the model number.

You can get a list of model repositories and models you have created inside the project by using the following commands.
2. Sweep — Optimize hyperparameters
So far, we ran a single machine learning experiment and saved it as a model inside a model repository. In this section, we will use a sweep to find the optimal hyperparameter value. First copy and paste the following command and while the sweep is running we will explain each options.
The first part of the command defines the key objective and number of experiments.
--objective-type— target object (either to minimize or maximize the metric)--objective-goal— target metric name as defined and logged usingvessl.log()--objective-metric— target metric value--num-experiments— total number of experiments--num-parallel— the number of experiments to run in parallel--num-failed— the number of failed experiments before the sweep terminates
Next, we specified the details of the parameters and which algorithm to use. In this example, the optimizer is a categorical type and the option values are listed as an array. The batch_size is an int value and the search space is set using max, min, and step.
The command is then followed by cluster, resource, image, dataset, and command options, similar to the vessl experiment create explained above.
You may find it easier to run vessl sweep create and specify the options through command prompts. For more information on sweep, refer to our sweep documentation.

3. Model Registry — Update and store the best model
Now that we ran multiple experiments using a sweep, let's find the optimal experiment. vessl sweep best-experiment returns the experiment information with the best specified metric value. In this example, the command will return the details of the experiment with the maximum val_accuracy.

Let's create a v0.0.2 model with vessl model create from the output of the best sweep experiment. You can get the experiment ID using the vessl experiment read command.
Finally, you can view the performance of your model by using vessl model read and specifying the model repository, followed by the model number.

We covered the overall workflow of VESSL using the client CLI. We can also repeat the same process using the client SDK or through Web UI. Now, try this guide with your own code and dataset.
Last updated