First Steps
note
This tutorial assumes that you've already signed up to ClearML
ClearML provides tools for automation, orchestration, and tracking, all key in performing effective MLOps.
Effective MLOps relies on the ability to scale work beyond one's own computer. Moving from your own machine can be time-consuming. Even assuming that you have all the drivers and applications installed, you still need to manage multiple python environments for different packages / package versions, or worse - manage different Dockers for different package versions.
Not to mention, when working on remote machines, executing experiments, tracking what's running where, and making sure machines are fully utilized at all times become daunting tasks.
This can create overhead that derails you from your core work!
ClearML Agent was designed to deal with such issues and more! It is a tool responsible for executing experiments on remote machines: on-premises or in the cloud! ClearML Agent provides the means to reproduce and track experiments in your machine of choice through the ClearML WebApp with no need for additional code.
The agent will set up the environment for a specific Task’s execution (inside a Docker, or bare-metal), install the required python packages, and execute & monitor the process.
#
Set up an AgentLet's install the agent!
Connect the agent to the server by creating credentials, then run this:
note
If you've already created credentials, you can copy-paste the default agent section from here (this is optional. If the section is not provided the default values will be used)
Start the agent's daemon and assign it to a queue.
A queue is an ordered list of Tasks that are scheduled for execution. The agent will pull Tasks from its assigned queue (
default
in this case), and execute them one after the other. Multiple agents can listen to the same queue (or even multiple queues), but only a single agent will pull a Task to be executed.
#
Clone an ExperimentExperiments already in the system can be reproduced for validation, or used as a baseline for further experimentation. Cloning a task duplicates the task’s configuration, but not its outputs.
To clone an experiment in the ClearML WebApp:
- Click on any project card to open its experiments table
- Right click one of the experiments on the table
- Click Clone in the context menu, which will open a CLONE EXPERIMENT window.
- Click CLONE in the window.
The newly cloned experiment will appear and its info panel will slide open. The cloned experiment is in draft mode, so it can be modified. You can edit the Git / code references, control the python packages to be installed, specify the Docker container image to be used, or change the hyperparameters and configuration files. See Modifying Experiments for more information about editing experiments in the UI.
#
Enqueue an ExperimentOnce you have set up an experiment, it is now time to execute it.
To execute an experiment through the ClearML WebApp:
- Right click your draft experiment (the context menu is also available through the
button on the top right of the experiment’s info panel)
- Click ENQUEUE, which will open the ENQUEUE EXPERIMENT window
- In the window, select
default
in the queue menu - Click ENQUEUE
This action pushes the experiment into the default
queue. The experiment's status becomes Pending until an agent
assigned to the queue fetches it, at which time the experiment’s status becomes Running. The agent executes the
experiment, and the experiment can be tracked and its results visualized.
#
Programmatic InterfaceThe cloning, modifying, and enqueuing actions described above can also be performed programmatically.
#
First Steps#
Access Previously Executed ExperimentsAll Tasks in the system can be accessed through their unique Task ID, or based on their properties using the Task.get_task
method. For example:
Once a specific Task object has been obtained, it can be cloned, modified, and more. See Advanced Usage.
#
Clone an ExperimentTo duplicate an experiment, use the Task.clone
method, and input either a
Task object or the Task’s ID as the source_task
argument.
#
Enqueue an ExperimentTo enqueue the task, use the Task.enqueue
method, and input the Task object
with the task
argument, and the queue to push the task into with queue_name
.
#
Advanced UsageBefore execution, use a variety of programmatic methods to manipulate a task object.
#
Modify HyperparametersHyperparameters are an integral part of Machine Learning code as they let you control the code without directly modifying it. Hyperparameters can be added from anywhere in your code, and ClearML supports multiple ways to obtain them!
Users can programmatically change cloned experiments' parameters.
For example:
#
Report ArtifactsArtifacts are files created by your task. Users can upload multiple types of data, objects and files to a task anywhere from code.
Artifacts serve as a great way to pass and reuse data between tasks. Artifacts can be retrieved by accessing the Task that created them. These artifacts can be modified and uploaded to other tasks.
By facilitating the communication of complex objects between tasks, artifacts serve as the foundation of ClearML's Data Management and pipeline solutions.
#
Log ModelsLogging models into the model repository is the easiest way to integrate the development process directly with production. Any model stored by a supported framework (Keras / TF / PyTorch / Joblib etc.) will be automatically logged into ClearML.
ClearML also offers methods to explicitly log models. Models can be automatically stored on a preferred storage medium (s3 bucket, google storage, etc.).
#
Log MetricsLog as many metrics as you want from your processes using the Logger module. This improves the visibility of your processes’ progress.
You can also retrieve reported scalars for programmatic analysis:
#
Query ExperimentsYou can also search and query Tasks in the system. Use the Task.get_tasks
method to retrieve Task objects and filter based on the specific values of the Task - status, parameters, metrics and more!
#
Manage Your DataData is probably one of the biggest factors that determines the success of a project. Associating a model’s data with the model's configuration, code, and results (such as accuracy) is key to deducing meaningful insights into model behavior.
ClearML Data allows you to version your data, so it's never lost, fetch it from every machine with minimal code changes, and associate data to experiment results.
Logging data can be done via command line, or programmatically. If any preprocessing code is involved, ClearML logs it as well! Once data is logged, it can be used by other experiments.