# Setup AIM for ML experiment tracking

{% hint style="info" %}
Setup time: 2 minutes
{% endhint %}

## What is AIM?

Aim is an open-source, self-hosted ML experiment tracking tool.

It offers a beautiful and performant UI to track 1000s of training runs and compare them under a single dashboard.

AIM UI also offers an SDK to query your runs' metadata programmatically.

{% embed url="<https://user-images.githubusercontent.com/13848158/136374529-af267918-5dc6-4a4e-8ed2-f6333a332f96.gif>" %}

> More info available at AIM’s [GitHub Repo](https://github.com/aimhubio/aim)

**AIM** also outperforms **Tensorboard** in the following ways:

1. TensorBoard becomes really slow and hard to use when a few hundred training runs are queried / compared whereas AIM is built to handle 1000s of training runs.
2. TensorBoard doesn't have features to group, aggregate the metrics whereas with AIM you can search, group, aggregate via params - deeply explore all the tracked data (metrics, params, images) on the UI.

### Why use AIM in your Q Blocks GPU instances?

Q Blocks GPU powered instances are designed to make your work as an ML engineer much easier by offering pre-configured instances with different ML environments and thus help you quickly get started with your ML model training runs and swiftly perform 1000s of experiments.

With AIM, you can now track 1000s of experiments under one roof. Thus, making your job even more easier and efficient.

### Pre-requisites for AIM Setup:

1. **Launch a GPU instance on Q Blocks:**
   1. Launching a GPU powered instance on Q Blocks in fairly straightforward.
   2. If not sure how to proceed, use this guide: [Launch a GPU instance on Q Blocks](https://www.notion.so/525c274558064bc7890a6f5704b193c0?pvs=21)
2. **Get your instance’s open-port:**
   1. Open port represents a port on which you can run any service and then access it publicly.
   2. Once your instance is launched, you will see “More Info” dropdown on your instance bar.
   3. Click on “More Info” Dropdown to copy the <mark style="color:red;">**Extra Port**</mark> and <mark style="color:purple;">**Host URL**</mark> information.

### Setup AIM Dashboard:

AIM can be installed and launched within just 2 lines of code.

Run the following commands in your instance’s bash terminal.

#### Install AIM:

```bash
pip install aim
```

#### Launch AIM Service:

```bash
aim up -h 0.0.0.0 -p Extra_Port
```

> Replace <mark style="color:red;">Extra\_Port</mark> with the Port you have copied from your instance's "More info" section.

### Access AIM Dashboard:

Once the AIM service has been launched, its dashboard will become available at the following URL:

```bash
http://Host_URL:Extra_Port
```

It should looking something like this:

<figure><img src="/files/13GCXGyVCEsFHdDUDffg" alt="" width="563"><figcaption></figcaption></figure>

Once the dashboard is up and running, you can simply call AIM in your python code and then easily log the experiments that can be viewed and compared in the dashboard.

## AIM Integrations:

AIM can easily be imported in your python code.

```python
import aim
```

AIM also offers direct integration with frameworks such as:

1. Pytorch Lightening
2. HuggingFace
3. Keras
4. XGBoost

Refer to [this section](https://github.com/aimhubio/aim#integrations) for more information on how to easily import AIM into your codebase.

If you face issues with the installation then reach out to us at <support@qblocks.cloud>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qblocks.cloud/q-blocks-how-to-guide/setup-aim-for-ml-experiment-tracking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
