### Setup Testing Environment Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Install specific requirements for the testing environment within the 'tests' directory. ```shell cd tests pip install -r requirements.txt ``` -------------------------------- ### Install Aim Dependencies and Package Source: https://github.com/aimhubio/aim/blob/main/requirements.txt Installs dependencies from setup.py and the Aim package in editable mode. Use this command in the project root. ```bash -e ./aim/web/ui ``` ```bash -e . ``` -------------------------------- ### Aim Examples Source: https://github.com/aimhubio/aim/blob/main/docs/source/index.md Examples demonstrating the usage of Aim for specific tasks. ```APIDOC ## Examples ### Track and compare GANs with Aim This example demonstrates how to use Aim to track and compare Generative Adversarial Networks (GANs), likely involving image data. ``` -------------------------------- ### Install Aim Package Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/jupyter_notebook_ui.md Install the Aim package using pip. This is the first step before using Aim in your notebook. ```jupyter !pip install aim ``` -------------------------------- ### Start UI Development Server Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Launch the development server for the Aim UI. ```shell npm start ``` -------------------------------- ### Start Aim Watcher Service Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/notifications.md Run this command to start the Aim watcher service. Replace `` with the actual path to your Aim repository. ```shell aim-watcher --repo start ``` -------------------------------- ### Dockerfile for Aim on K8S Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/k8s_deployment.md This Dockerfile installs the Aim package and configures it to run as a service within a container. It initializes the Aim repository and starts the Aim server, listening on all interfaces. ```Dockerfile # python3.7 should be sufficient to run Aim FROM python:3.7 # install the `aim` package on the latest version RUN pip install --upgrade aim # make a directory where the Aim repo will be initialized, `/aim` RUN mkdir /aim ENTRYPOINT ["/bin/sh", "-c"] # have to run `aim init` in the directory that stores aim data for # otherwise `aim up` will prompt for confirmation to create the directory itself. # We run aim listening on 0.0.0.0 to expose all ports. Also, we run # using `--dev` to print verbose logs. Port 43800 is the default port of # `aim up` but explicit is better than implicit. CMD ["echo \"N\" | aim init --repo /aim && aim up --host 0.0.0.0 --port 43800 --workers 2 --repo /aim"] ``` -------------------------------- ### Complete Aim tracking example Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md A full example demonstrating how to initialize a Run, log hyperparameters, and track a metric within a loop. This script can be executed to generate data for Aim UI exploration. ```python # aim_test.py from aim import Run run = Run() # set training hyperparameters run['hparams'] = { 'learning_rate': 0.001, 'batch_size': 32, } # log metric for i in range(10): run.track(i, name='numbers') ``` -------------------------------- ### Install Aim Package Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md Ensure you have Aim version 3.4.0 or higher installed. This is a prerequisite for running the Aim server. ```shell $ pip install "aim>=3.4.0" ``` -------------------------------- ### Start Aim Web UI Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Starts the Aim web UI locally. Options include specifying the host, port, repository path, and enabling development mode or profiler. ```shell aim up [ARGS] ``` -------------------------------- ### Install Development Requirements and Aim Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Install necessary development dependencies and the Aim package in editable mode for backend development. ```shell pip install -r requirements.dev.txt pip install -e . ``` -------------------------------- ### Verify Aim Installation Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Check if Aim has been installed correctly by running the version command or importing it in a Python REPL. ```shell aim version ``` ```python import aim ``` -------------------------------- ### Verify Aim installation Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Check if Aim was installed correctly by running the version command. ```shell aim version ``` -------------------------------- ### Access Run Meta-parameters Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/sdk.md Demonstrates how to get run meta-parameters using dictionary-like access. Supports nested keys for deeper parameter retrieval. ```python >>> run = Run('3df703c') >>> run['hparams'] # -> {'batch_size': 42} >>> run['hparams', 'batch_size'] # -> 42 ``` -------------------------------- ### Install UI Dependencies Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Install npm dependencies required for developing the Aim UI. ```shell cd aim/web/ui npm install ``` -------------------------------- ### Enable System Parameters Logging Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/configure_runs.md Initialize an Aim Run instance with `log_system_params=True` to automatically log environment variables, executables, CLI arguments, installed packages, and Git information. ```python run = Run(log_system_params=True) ``` -------------------------------- ### TensorBoard log directory structure example Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/convert_data.md This is an example of a TensorBoard log directory structure that Aim can process. Directories are categorized into `group`, `run`, and `context` to organize training runs. ```default ~/my_logdir/ ├> run_1/ │ ├> │ └> ├> group_1/ │ ├> (THIS LOG WILL BE IGNORED) │ ├> run_2/ │ │ ├> train/ │ │ │ ├> │ │ │ └> │ │ ├> validate/ │ │ │ ├> │ │ │ └> │ │ ├> (IGNORED IF "--flat" IS ACTIVE) │ │ └> (IGNORED IF "--flat" IS ACTIVE) │ └> run_3/ │ ├> │ └> ├> (THIS LOG WILL BE IGNORED) └> (THIS LOG WILL BE IGNORED) ``` -------------------------------- ### Start Aim Tracking Server Source: https://context7.com/aimhubio/aim/llms.txt Launch the Aim tracking server for centralized experiment tracking in multi-host environments. Supports configuration via host, port, and SSL certificates. ```bash # Start the tracking server aim server --host 0.0.0.0 --port 53800 # With SSL aim server --ssl-keyfile key.pem --ssl-certfile cert.pem ``` -------------------------------- ### Import Audio object Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/supported_types.md Import the Audio object from the aim library to start tracking audio data. ```python from aim import Audio ``` -------------------------------- ### Run Aim Server Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md Start the Aim remote tracking server. Specify the path to your Aim repository. The server will listen on 0.0.0.0:53800 by default. ```shell $ aim server --repo ``` -------------------------------- ### Install Aim using pip Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Install the Aim Python package using pip. Ensure you are using Python 3.6+. ```shell pip3 install aim ``` -------------------------------- ### Example JSON Output for Base Project Statistics Source: https://github.com/aimhubio/aim/blob/main/troubleshooting/TROUBLESHOOTING.md This is an example of the JSON output generated by the `base_project_statistics.py` script, detailing various statistics about an Aim repository. ```json { "runs_count": 19, "unindexed_runs_count": 3, "metrics_count": 323, "avg_metrics_per_run": 17.0, "max_metrics_per_run": 17, "avg_params_per_run": 224.58, "max_params_per_run": 225, "runs_query_time": 0.036, "metrics_query_time": 15.7 } ``` -------------------------------- ### Initialize Run with Remote Tracking URL Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md Create an Aim Run object by providing the remote tracking server URL. Replace the example IP with your server's IP or hostname. ```python from aim import Run aim_run = Run(repo='aim://172.3.66.145:53800') # replace example IP with your tracking server IP/hostname # Log run parameters aim_run['params'] = { 'learning_rate': 0.001, 'batch_size': 32, } ... ``` -------------------------------- ### Full PyTorch MNIST Example with Remote Tracking Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md A complete example demonstrating PyTorch model training on the MNIST dataset, with hyperparameter tracking using the Aim remote server. Ensure the remote tracking URL is correctly specified. ```python from aim import Run import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Initialize a new Run with remote tracking URL aim_run = Run(repo='aim://172.3.66.145:53800') # replace example IP with your tracking server IP/hostname # Device configuration device = torch.device('cpu') # Hyper parameters num_epochs = 5 num_classes = 10 batch_size = 16 learning_rate = 0.01 # aim - Track hyper parameters aim_run['hparams'] = { 'num_epochs': num_epochs, 'num_classes': num_classes, 'batch_size': batch_size, 'learning_rate': learning_rate, } # MNIST dataset train_dataset = torchvision.datasets.MNIST(root='./data/', train=True, transform=transforms.ToTensor(), download=True) test_dataset = torchvision.datasets.MNIST(root='./data/', train=False, transform=transforms.ToTensor()) # Data loader train_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True) test_loader = torch.utils.data.DataLoader(dataset=test_dataset, batch_size=batch_size, shuffle=False) # Convolutional neural network (two convolutional layers) class ConvNet(nn.Module): def __init__(self, num_classes=10): super(ConvNet, self).__init__() self.layer1 = nn.Sequential( nn.Conv2d(1, 16, kernel_size=5, stride=1, padding=2), nn.BatchNorm2d(16), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2)) self.layer2 = nn.Sequential( nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), nn.BatchNorm2d(32), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2)) self.fc = nn.Linear(7 * 7 * 32, num_classes) def forward(self, x): out = self.layer1(x) out = self.layer2(out) out = out.reshape(out.size(0), -1) out = self.fc(out) return out model = ConvNet(num_classes).to(device) # Loss and optimizer criterion = nn.CrossEntropyLoss() optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate) ``` -------------------------------- ### Run Aim UI Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Start the Aim UI application from the command line. This command makes your logged experiment data accessible via a web browser. ```shell aim up ``` -------------------------------- ### Install specific nightly Aim releases Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Install a specific daily development package of Aim using its version string. ```shell pip3 install aim==3.x.0.devyyyymmdd ``` -------------------------------- ### Start Aim Watcher Service Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Initiate the Aim watcher service to monitor training runs for issues like being stuck or failed. Specify the repository path using `--repo`. ```shell aim-watcher --repo . start ``` -------------------------------- ### Integrate Aim with Python Code Source: https://github.com/aimhubio/aim/blob/main/README.md Initialize an Aim Run object and log hyperparameters and metrics. Ensure you have the 'aim' library installed. ```python from aim import Run # Initialize a new run run = Run() # Log run parameters run["hparams"] = { "learning_rate": 0.001, "batch_size": 32, } # Log metrics for i in range(10): run.track(i, name='loss', step=i, context={ "subset":"train" }) run.track(i, name='acc', step=i, context={ "subset":"train" }) ``` -------------------------------- ### Aim CLI - version Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Displays the version of the Aim CLI currently installed. ```APIDOC ## GET /api/version ### Description Displays the version of the Aim CLI currently installed. ### Method GET ### Endpoint /api/version ### Response #### Success Response (200) - **version** (string) - The current version of the Aim CLI. #### Response Example ```json { "version": "2.0.0" } ``` ``` -------------------------------- ### Query Runs Programmatically via SDK Source: https://github.com/aimhubio/aim/blob/main/README.md Use the Aim Python SDK to query and access tracked metadata. This example demonstrates how to initialize a repository, define a query, and iterate through runs and their metrics. ```python from aim import Repo my_repo = Repo('/path/to/aim/repo') query = "metric.name == 'loss'" # Example query # Get collection of metrics for run_metrics_collection in my_repo.query_metrics(query).iter_runs(): for metric in run_metrics_collection: # Get run params params = metric.run[...] # Get metric values steps, metric_values = metric.values.sparse_numpy() ``` -------------------------------- ### Aim Status Watcher CLI Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Commands for starting the training runs status monitoring service and configuring notification preferences. ```APIDOC # Aim status watcher CLI Aim status CLI offers an interface to start training runs status monitoring and configure how the notifications should be received. The entry point to this CLI is `aim-watcher`: ```shell $ aim-watcher [ARGS] SUBCOMMAND ``` ### Arguments | Args | Description | |----------------------|----------------------------------------------------------------------------------| | `--repo ` | Path to parent directory of `.aim` repo. *Current working directory by default*. | ### Sub-Commands | Sub-Commands | Description | |----------------|----------------------------------------------------------------| | `start` | Start watcher service to monitor and report stuck/failed Runs. | | `notifiers` | Configure how notifications should be received. | #### `start` Start watcher service for the given aim `Repo`. ```shell aim-watcher --repo . start ``` #### `notifiers` Manipulate notifiers configuration. **notifiers subcommands** ```shell $ aim-watcher notifiers add ``` ```shell $ aim-watcher notifiers list ``` ```shell $ aim-watcher notifiers remove [NOTIFIER_ID] ``` ```shell $ aim-watcher notifiers disable [NOTIFIER_ID] ``` ```shell $ aim-watcher notifiers enable [NOTIFIER_ID] ``` ``` -------------------------------- ### Install nightly Aim releases Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Install the latest development version of Aim, which includes features not yet released in stable versions. This may also install development versions of dependencies. ```shell pip3 install --pre aim ``` -------------------------------- ### Initialize Aim Repository and Launch UI (CLI) Source: https://context7.com/aimhubio/aim/llms.txt Use the Aim CLI to initialize a new Aim repository and launch the interactive UI. Options are available to specify host, port, repository path, and SSL settings. ```bash # Initialize a new Aim repository aim init # Launch the Aim UI aim up aim up --host 0.0.0.0 --port 43800 aim up --repo /path/to/repo # Launch with SSL aim up --ssl-keyfile key.pem --ssl-certfile cert.pem # Read-only mode aim up --read-only ``` -------------------------------- ### Create an AudiosList Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Instantiate an AudiosList object with fetched audios. This is used to display a list of audio files. ```python audios = repo.fetch_audios() AudiosList(audios) ``` -------------------------------- ### Initialize Aim Repo Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/query_runs.md Initialize a Repo instance to interact with your Aim repository. Provide the path to your Aim repository. ```python from aim import Repo my_repo = Repo('/path/to/aim/repo') ``` -------------------------------- ### Build Aim Documentation Locally Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Commands to set up and build the Aim documentation locally. Ensure you are using a Python interpreter version 3.10 or lower. Documentation will be available at docs/build/html/index.html. ```shell pip install -r requirements.dev.txt cd docs pip install -r requirements.txt make html ``` -------------------------------- ### Download and Run Base Project Statistics Script Source: https://github.com/aimhubio/aim/blob/main/troubleshooting/TROUBLESHOOTING.md Use this command to download the `base_project_statistics.py` script and then execute it on your Aim repository to gather statistics. Replace `` with the actual path to your Aim repository. ```bash wget https://raw.githubusercontent.com/aimhubio/aim/main/troubleshooting/base_project_statistics.py python -m base_project_statistics --repo ``` -------------------------------- ### Enable Aim Profiling Source: https://github.com/aimhubio/aim/blob/main/docs/source/understanding/running_aim_with_profiling.md Run this command to enable the profiling feature. This will create a `.aim/profiler` directory to store performance trace files. ```bash aim up --profiler ``` -------------------------------- ### Initialize Aim repository Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/setup.md Initialize a new Aim repository in the current working directory. This creates the necessary structure for logging training runs. ```shell aim init ``` -------------------------------- ### Aim CLI - up Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Runs the Aim web UI for the given repository locally. ```APIDOC ## POST /api/up ### Description Starts the Aim web UI locally. This command allows users to visualize and interact with their recorded experiments. ### Method POST ### Endpoint /api/up ### Parameters #### Query Parameters - **repo** (string) - Optional - Path to parent directory of `.aim` repo. Current working directory by default. - **host** (string) - Optional - Specify host address for the UI. - **port** (integer) - Optional - Specify port to listen to. Default is 43800. - **dev** (boolean) - Optional - Run UI in development mode (enables hot-reloading). - **profiler** (boolean) - Optional - Enables API profiling which logs run trace inside `.aim/profiler` directory. - **log_level** (string) - Optional - Specifies log level for python logging package. WARNING by default, DEBUG when –dev option is provided. ### Request Example ```json { "repo": "/path/to/your/repo", "port": 43800, "dev": false } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message that the UI has started. #### Response Example ```json { "message": "Aim UI started successfully on http://localhost:43800" } ``` ``` -------------------------------- ### DataFrame Conversion Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/sdk.md Method to get run properties and parameters as a pandas DataFrame. ```APIDOC ## GET /run/dataframe ### Description Get run properties and params as pandas DataFrame. ### Method GET ### Endpoint /run/dataframe ### Parameters #### Query Parameters - **include_props** (int) - Optional - If true, include run structured props. - **include_params** (int) - Optional - If true, include run parameters. ### Response #### Success Response (200) - **dataframe** (pandas.DataFrame) - DataFrame containing run properties and parameters. #### Response Example ```json { "dataframe": "" } ``` ``` -------------------------------- ### Run Meta-parameter Operations Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/sdk.md Operations for getting, setting, and deleting run meta-parameters. ```APIDOC ## GET /run/meta-params/{key} ### Description Get run meta-parameter by key. ### Method GET ### Endpoint /run/meta-params/{key} ### Parameters #### Path Parameters - **key** (str) - Required - Path to Run meta-parameter. ### Response #### Success Response (200) - **value** (any) - Collected sub-tree of Run meta-parameters. #### Response Example ```json { "value": { "batch_size": 42 } } ``` ## SET /run/meta-params/{key} ### Description Set Run top-level meta-parameter. ### Method POST ### Endpoint /run/meta-params/{key} ### Parameters #### Path Parameters - **key** (str) - Required - Top-level meta-parameter name. Use ellipsis to reset run’s all meta-parameters. #### Request Body - **val** (any) - Required - Meta-parameter value. ### Request Example ```json { "val": { "batch_size": 42 } } ``` ### Response #### Success Response (200) - **message** (str) - Confirmation message. #### Response Example ```json { "message": "Meta-parameter updated successfully." } ``` ## DELETE /run/meta-params/{key} ### Description Remove key from run meta-params. ### Method DELETE ### Endpoint /run/meta-params/{key} ### Parameters #### Path Parameters - **key** (str) - Required - Meta-parameter path. ### Response #### Success Response (200) - **message** (str) - Confirmation message. #### Response Example ```json { "message": "Meta-parameter removed successfully." } ``` ``` -------------------------------- ### Override XGBoost AimCallback Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/integration_guides.md Customize the AimCallback for XGBoost to track metrics after each iteration. This example logs text-based metrics from `evals_log`. ```python from aim import Text from aim.xgboost import AimCallback class CustomCallback(AimCallback): def after_iteration(self, model, epoch, evals_log): for data, metric in evals_log.items(): for metric_name, log in metric.items(): self.experiment.track(Text(log), name=metric_name) return super().after_iteration(model, epoch, evals_log) ``` -------------------------------- ### Run Aim UI Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md Launch the Aim UI to visualize tracked experiments. This command requires the path to your Aim repository. ```shell $ aim up --repo ``` -------------------------------- ### Aim CLI - init Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Initializes the Aim repository to record experiments. This is an optional step as Aim auto-initializes on the first function call. Re-initialization clears existing data. ```APIDOC ## POST /api/init ### Description Initializes the `aim` repository to record experiments. Creates a `.aim` directory to save recorded experiments. Running `aim init` in an existing repository will prompt the user for re-initialization. ### Method POST ### Endpoint /api/init ### Parameters #### Query Parameters - **repo** (string) - Optional - Path to parent directory of `.aim` repo. Current working directory by default. ### Request Example ```json { "repo": "/path/to/your/repo" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of initialization. #### Response Example ```json { "message": ".aim repository initialized successfully." } ``` ``` -------------------------------- ### Create Component with Path and Lint Source: https://github.com/aimhubio/aim/blob/main/aim/web/ui/tasks/cli/README.md Use this command to create a new component with a specified name and path, and automatically run lint to fix formatting. Requires the 'create-component' command from the cli. ```bash $ node cli/index.js create-component --name= --path= --lint ``` -------------------------------- ### Log Metrics and Hyperparameters in Python Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Use this snippet to log custom metrics, hyperparameters, and other key-value pairs within any Python script. Ensure the 'aim' library is installed. ```python from aim import Run run = Run() # Save inputs, hparams or any other `key: value` pairs run['hparams'] = { 'learning_rate': 0.001, 'batch_size': 32, } # ... for step in range(10): # Log metrics to visualize performance run.track(step, name='metric_name') # ... ``` -------------------------------- ### Track Metrics and Parameters with Aim SDK Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/search.md Initialize runs, define parameters, and track metrics within different contexts using the Aim SDK. This sets up data for querying. ```python from aim import Run # Initialize run_1 # Define its params and track loss metric within test and train contexts run_1 = Run() run_1['learning_rate'] = 0.001 run_1['batch_size'] = 32 for i in range(10): run_1.track(i, name='loss', context={ 'subset':'train' }) run_1.track(i, name='loss', context={ 'subset':'test' }) # Initialize run_2 run_2 = Run() run_2['learning_rate'] = 0.0007 run_2['batch_size'] = 64 for i in range(20): run_2.track(i, name='loss', context={ 'subset':'train' }) run_2.track(i, name='loss', context={ 'subset':'test' }) run_2.track(i/100, name='accuracy') ``` -------------------------------- ### Export SSL Certificates for Aim Client Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/remote_tracking.md Configure the Aim client to use SSL by setting the `AIM_CLIENT_SSL_CERTIFICATES_FILE` environment variable. This example generates self-signed certificates and combines them into a single file. ```shell export __AIM_CLIENT_SSL_CERTIFICATES_FILE__=/path/of/the/certs/file ``` ```shell # generate the cert and key files openssl genrsa -out server.key 2048 openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650 -subj '/CN={DOMAIN_NAME}' # append the private key to the certs in a new file cat server.crt server.key > server.includesprivatekey.pem # set the env variable for aim client export __AIM_CLIENT_SSL_CERTIFICATES_FILE__=./server.includesprivatekey.pem ``` -------------------------------- ### Create Kit Component with Lint Source: https://github.com/aimhubio/aim/blob/main/aim/web/ui/tasks/cli/README.md Run this npm script to create a component named 'ComponentName' in the './src/components/kit' folder and apply lint formatting. This is a shortcut for creating kit components. ```bash $ npm run crc-kit -- ``` -------------------------------- ### Instantiate AimLogger with Prophet Model Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Initialize the AimLogger by passing your Prophet model instance, repository path, and experiment name. ```python model = Prophet() logger = AimLogger(prophet_model=model, repo=".", experiment="prophet_test") ``` -------------------------------- ### Log DVC Metadata with Aim Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/supported_types.md Use the `DvcData` object to log DVC repository information, including tracked files, to an Aim Run. Ensure DVC is installed and configured in your project. ```python from aim.sdk import Run from aim.sdk.objects.plugins.dvc_metadata import DvcData run = Run(system_tracking_interval=None) path_to_dvc_repo = '.' run['dvc_info'] = DvcData(path_to_dvc_repo) ``` -------------------------------- ### Initialize Aim Run and Log Hyperparameters Source: https://github.com/aimhubio/aim/blob/main/docs/source/examples/images_explorer_gan.md Initialize an Aim run and log hyperparameters within a GAN trainer class. This sets up the experiment tracking. ```python class Trainer(): def __init__( self, name = 'default', results_dir = 'results', models_dir = 'models', ... ): ... self.run = aim.Run() # Initialize aim.Run self.run['hparams'] = hparams # Log hyperparams ... ``` -------------------------------- ### Create an Aim Run Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/manage_runs.md Initialize a new Run object to track ML training metadata. Specify the repository path and experiment name. System resource and terminal log capturing are enabled by default. ```python from aim import Run my_run = Run( repo='/repo/path/to/store/runs', experiment='experiment_name' ) ``` -------------------------------- ### DVC Info Logged in Aim Run Parameters Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/supported_types.md This JSON structure represents the DVC metadata logged to an Aim Run, showing the dataset source and a list of tracked files. This is an example of the output after applying the DVC logging code. ```json { 'dvc_info.dataset.source': 'dvc', 'dvc_info.dataset.tracked_files': [ '.dvcignore', '.github', '.gitignore', 'README.md', 'data', 'dvc.lock', 'dvc.yaml', 'model.pkl', 'params.yaml', 'prc.json', 'roc.json', 'scores.json', 'src' ] } ``` -------------------------------- ### Run Aim UI within a Notebook Cell on SageMaker Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/sagemaker_notebook_ui.md Start Aim UI directly within a notebook cell on SageMaker. The `--proxy-url` argument is mandatory for SageMaker instances. The default port for the notebook extension is 43801. ```jupyter %aim up --proxy-url=https://.notebook..sagemaker.aws ``` -------------------------------- ### Repo Initialization Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/sdk.md Initialize or open an Aim repository. The `Repo` object provides methods for accessing runs, metrics, and querying data within a repository. ```APIDOC ## Repo Initialization ### Description Initializes or opens an Aim repository. Provides methods for accessing Runs, Metrics, and querying data. ### Class `aim.sdk.repo.Repo` ### Parameters - **path** (str) - Required - Path to Aim repository. - **read_only** (bool, optional) - Flag for opening Repo in readonly mode. False by default. - **init** (bool, optional) - Flag used to initialize new Repo. False by default. Recommended to use `aim init` command instead. ### Class Methods #### `Repo.exists(path)` Check Aim repository existence. - **Parameters:** - **path** (str) - Path to Aim repository. - **Returns:** True if repository exists, False otherwise. #### `Repo.default_repo(init=False)` Named constructor for default repository. Searches nearest .aim directory from current directory to root directory. If not found, return Repo for current directory. - **Parameters:** - **init** (bool, optional) - Flag used to initialize new Repo. False by default. - **Returns:** `Repo` object. #### `Repo.from_path(path, read_only=None, init=False)` Named constructor for Repo for given path. - **Parameters:** - **path** (str) - Path to Aim repository. - **read_only** (bool, optional) - Flag for opening Repo in readonly mode. False by default. - **init** (bool, optional) - Flag used to initialize new Repo. False by default. - **Returns:** `Repo` object. ### Request Example ```python from aim.sdk.repo import Repo # Initialize a new repo repo = Repo.from_path("./my_aim_repo", init=True) # Open an existing repo repo = Repo("./my_aim_repo") # Open default repo default_repo = Repo.default_repo() ``` ### Response Example ```json { "message": "Repo object created successfully" } ``` ``` -------------------------------- ### Initialize and Use Live Update Worker Source: https://github.com/aimhubio/aim/blob/main/aim/web/ui/src/services/live-update/README.md Initializes a live update worker, sets its configuration, subscribes to API call results, and demonstrates starting, stopping, and closing the worker. Ensure the subscriber function is correctly bound if it has a context. ```javascript // to describe webpack as this is a worker file import LUWorker from 'comlink-loader!./services/live-update/Worker'; import { getDataFromTransferable } from 'services/live-update' import * as Comlink from 'comlink'; function initizeWorker(subscriber) { let worker = new LUWorker(); // set config [name, uri, delay, enableLog] worker.setConfig('Runs', 'runs/search/run', 1000, true); worker.subscribeToApiCallResult( // if subscriber has a context, please bind to the context Comlink.proxy(subscriber), ); return worker; } const subscriber = (data) => { const obj = getDataFromTransferable(data); console.log("DATA --- ", obj); // send to render } const w = initizeWorker(subscriber); w.start({ q: 'test', limit: 50 }) // some condition w.stop().then().catch()// will pause to call // some condition // w.start({ q: 'test1', limit: 60 }).then().catch() // to terminate w.close(); ``` -------------------------------- ### Create New Component with Aim Source: https://github.com/aimhubio/aim/blob/main/CONTRIBUTING.md Use this command to generate a new component folder with necessary files. Replace 'ComponentName' with your desired component name. ```shell npm run crc 'ComponentName' ``` -------------------------------- ### Log Hugging Face Datasets Info with Aim Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/supported_types.md Use the `HFDataset` wrapper to log Hugging Face dataset metadata to an Aim Run. This allows for easy retrieval and association of dataset information with experiments. Ensure the `datasets` library is installed. ```python from datasets import load_dataset from aim import Run from aim.hf_dataset import HFDataset # create dataset object dataset = load_dataset('rotten_tomatoes') # store dataset metadata run = Run() run['datasets_info'] = HFDataset(dataset) ``` -------------------------------- ### Create a LineChart Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Instantiate a LineChart object with fetched metrics. Specify 'timestamps' for the x-axis. ```python metrics = repo.fetch_metrics() linechart = LineChart(metrics, x='timestamps') ``` -------------------------------- ### Import AimLogger for CatBoost Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Import AimLogger from the aim.catboost module to track metadata during CatBoost training. ```python # call sdk aim.catboost from aim.catboost import AimLogger ``` -------------------------------- ### Initialize MXNet training with AimLoggingHandler Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Create an AimLoggingHandler instance, specifying the repository, experiment name, log interval, and metrics. Pass this handler to the `event_handlers` list during the `est.fit` call. ```python aim_log_handler = AimLoggingHandler(repo='.', experiment_name='mxnet_example', log_interval=1, metrics=[train_acc, train_loss, val_acc]) est.fit(train_data=train_data_loader, val_data=val_data_loader, epochs=num_epochs, event_handlers=[aim_log_handler]) ``` -------------------------------- ### Initialize and Track Run Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/search.md Initializes a new run and tracks metrics over iterations. Use this to log experiment progress. ```python run_3 = Run() run_3['learning_rate'] = 0.005 run_3['batch_size'] = 16 for i in range(30): run_3.track(i, name='loss', context={ 'subset':'train' }) run_3.track(i, name='loss', context={ 'subset':'test' }) run_3.track(i/100, name='accuracy') ``` -------------------------------- ### Create an ImagesList Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Instantiate an ImagesList object with fetched images. This is used to display a list of images. ```python images = repo.fetch_images() ImagesList(images) ``` -------------------------------- ### Create Component with Lint Source: https://github.com/aimhubio/aim/blob/main/aim/web/ui/tasks/cli/README.md Run this npm script to create a component named 'ComponentName' in the './src/components/' folder and apply lint formatting. This is a general-purpose component creation script. ```bash $ npm run crc -- ``` -------------------------------- ### Track CatBoost Training with AimLogger Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Instantiate AimLogger and pass it to the log_cout parameter of the model.fit method. This automatically tracks metrics and hyperparameters. The logging_level can be adjusted for more detailed logs. ```python model.fit(train_data, train_labels, log_cout=AimLogger(loss_function='Logloss'), logging_level='Info') ``` -------------------------------- ### Initialize AimCallback and LoggerFactory for Acme Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Set up an Aim Run using AimCallback and create a logger factory to log training metadata. Specify the repository path and experiment name. ```python aim_run = AimCallback(repo=".", experiment_name="acme_test") def logger_factory( name: str, steps_key: Optional[str] = None, task_id: Optional[int] = None, ) -> loggers.Logger: return AimWriter(aim_run, name, steps_key, task_id) ``` -------------------------------- ### Create a FiguresList Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Instantiate a FiguresList object with fetched figures. This is used to display a list of figures. ```python figures = repo.fetch_figures() FiguresList(figures) ``` -------------------------------- ### Initialize PyTorch Lightning Trainer with AimLogger Source: https://context7.com/aimhubio/aim/llms.txt Integrate Aim with PyTorch Lightning by initializing the Trainer with AimLogger for automatic tracking of metrics and hyperparameters. ```python from pytorch_lightning import Trainer from aim.pytorch_lightning import AimLogger ``` -------------------------------- ### Initialize fastai learner with AimCallback Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Pass an instance of AimCallback to the `cbs` list when initializing your fastai learner. Configure the repository and experiment name for tracking. ```python learn = cnn_learner(dls, resnet18, pretrained=True, loss_func=CrossEntropyLossFlat(), metrics=accuracy, model_dir="/tmp/model/", cbs=AimCallback(repo='.', experiment='fastai_example')) ``` -------------------------------- ### Set Run Meta-parameters Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/sdk.md Illustrates setting top-level meta-parameters for a run. Use ellipsis to reset all meta-parameters. ```python >>> run = Run('3df703c') >>> run[...] = params >>> run['hparams'] = {'batch_size': 42} ``` -------------------------------- ### Fetch Metrics and Create LineChart Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Use `repo.fetch_metrics` to retrieve metric data based on a query and then visualize it using `LineChart`. The `repo` object is available by default in the report context. ```python ```aim metrics = repo.fetch_metrics('metric.name == "loss"') linechart = LineChart(metrics) ``` ``` -------------------------------- ### Upload Aim repository snapshot to cloud Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Creates a snapshot of the Aim repository and uploads it to a specified cloud storage bucket. ```shell $ aim runs upload [ARGS] ... ``` -------------------------------- ### Import AimCallback for LightGBM Source: https://github.com/aimhubio/aim/blob/main/docs/source/quick_start/integrations.md Import the AimCallback from the aim.lightgbm module to enable automatic tracking of LightGBM training processes. ```python from aim.lightgbm import AimCallback ``` -------------------------------- ### Upload Aim Runs to S3 Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/manage_runs.md Create a backup snapshot of an Aim repository in an AWS S3 bucket. Requires `boto3` package and AWS credentials. A new bucket will be created if it doesn't exist. ```shell aim runs upload bucket_name_1 ``` -------------------------------- ### Initialize and Track a Run Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/jupyter_notebook_ui.md Initialize a new Aim run and log hyperparameters. Remember to call `run.finalize()` when training is complete. ```python from aim import Run run = Run() run['hparams'] = { 'learning_rate': 0.001, 'batch_size': 32, } ``` -------------------------------- ### Create a TextsList Source: https://github.com/aimhubio/aim/blob/main/docs/source/ui/pages/reports.md Instantiate a TextsList object with fetched texts. This is used to display a list of texts. ```python texts = repo.fetch_texts() TextsList(texts) ``` -------------------------------- ### Set Artifacts Storage URI for Aim Run Source: https://github.com/aimhubio/aim/blob/main/docs/source/using/artifacts.md Configure the storage location for artifacts. Use 's3://' for AWS S3 or 'file://' for local file systems. This only needs to be done once per run. ```python import aim run = aim.Run() ``` ```python run.set_artifacts_uri(‘s3://aim/artifacts/’) ``` ```python run.set_artifacts_uri(’[file:///home/user/aim/artifacts/](file:///home/user/aim/artifacts/)’) ``` -------------------------------- ### Running Aim with Profiling Source: https://github.com/aimhubio/aim/blob/main/docs/source/index.md Guidance on enabling and utilizing profiling when running Aim. ```APIDOC ## Running Aim with Profiling ### Description This section explains why and how to enable profiling when running Aim, to help diagnose performance issues. ### Topics * **Why would you need to enable the profiling**: Discusses the use cases and benefits of enabling profiling. ``` -------------------------------- ### Aim CLI - server Source: https://github.com/aimhubio/aim/blob/main/docs/source/refs/cli.md Runs the Aim remote tracking server, accepting incoming RPC requests. ```APIDOC ## POST /api/server ### Description Runs a tracking server to collect tracked data from remote clients. This allows for centralized experiment tracking. ### Method POST ### Endpoint /api/server ### Parameters #### Query Parameters - **repo** (string) - Optional - Path to parent directory of `.aim` repo. Current working directory by default. - **host** (string) - Optional - Specify host address for the server. - **port** (integer) - Optional - Specify port to listen to. Default is 53800. - **ssl_keyfile** (string) - Optional - Specify path to keyfile for secure connection. - **ssl_certfile** (string) - Optional - Specify path to cert. file for secure connection. - **dev** (boolean) - Optional - Run server in development mode. - **log_level** (string) - Optional - Specifies log level for python logging package. WARNING by default, DEBUG when –dev option is provided. ### Request Example ```json { "repo": "/path/to/your/repo", "port": 53800, "ssl_keyfile": "/path/to/key.pem", "ssl_certfile": "/path/to/cert.pem" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message that the server has started. #### Response Example ```json { "message": "Aim tracking server started successfully on port 53800." } ``` ```