-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/parallel-tag-addition
# Conflicts: # CHANGELOG.md
- Loading branch information
Showing
14 changed files
with
263 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.25.1 | ||
3.26.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SEQUENCE_TYPE_MAP = { | ||
'int': 'metric', | ||
'float': 'metric', | ||
'float64': 'metric', | ||
'number': 'metric', | ||
'aim.image': 'images', | ||
'list(aim.image)': 'images', | ||
'aim.audio': 'audios', | ||
'list(aim.audio)': 'audios', | ||
'aim.text': 'texts', | ||
'list(aim.text)': 'texts', | ||
'aim.distribution': 'distributions', | ||
'aim.figure': 'figures', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Troubleshooting for Aim | ||
|
||
This is a collection of scripts and utilities to run over an Aim repo to collect unanimous information for debugging and reproducibility purposes. | ||
|
||
## Base Project Stats | ||
|
||
The `troubleshooting.base_project_statistics` script is a utility to collect and analyze statistics from **AIM repo**. | ||
It provides a report with base stats: the number of runs, metrics, and query times. | ||
Query time samples are collected by running sample basic queries. | ||
|
||
The output of the script is a JSON file containing the statistics. | ||
|
||
## How to Use the Command | ||
|
||
**Step 1:** Download the `base_project_statistics.py` is in your working directory. | ||
**Step 2:** Execute the script on the repo of interest | ||
|
||
```bash | ||
wget https://raw.githubusercontent.com/aimhubio/aim/main/troubleshooting/base_project_statistics.py | ||
python -m base_project_statistics --repo <path_to_repo> | ||
|
||
``` | ||
The command generates a JSON file in the current working directory, containing statistics about the repository. | ||
|
||
## Example JSON Output | ||
|
||
A typical output file contains the following information: | ||
|
||
```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 | ||
} | ||
``` | ||
|
||
### Key Fields | ||
|
||
- `runs_count`: Total number of runs in the repository. | ||
- `unindexed_runs_count`: Number of runs that are not indexed. | ||
- `metrics_count`: Total count of metrics across all runs. | ||
- `avg_metrics_per_run`: Average number of metrics per run. | ||
- `max_metrics_per_run`: Maximum number of metrics in a single run. | ||
- `avg_params_per_run`: Average number of parameters per run. | ||
- `max_params_per_run`: Maximum number of parameters in a single run. | ||
- `runs_query_time`: Time taken to query runs, in seconds. | ||
- `metrics_query_time`: Time taken to query metrics, in seconds. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import argparse | ||
import json | ||
import sys | ||
import time | ||
|
||
import tqdm | ||
|
||
import aim | ||
|
||
|
||
def count_metrics(run): | ||
run_metric_count = 0 | ||
for context in run.meta_run_tree.subtree('traces').keys(): | ||
run_metric_count += len(run.meta_run_tree.subtree(('traces', context)).keys_eager()) | ||
return run_metric_count | ||
|
||
|
||
def count_params(run): | ||
return count_dict_keys(run.meta_run_tree['attrs']) | ||
|
||
|
||
def count_dict_keys(params): | ||
""" | ||
Count the number of leaf nodes in a nested dictionary. | ||
A leaf node is a value that is not a dictionary. | ||
""" | ||
return sum( | ||
count_dict_keys(value) if isinstance(value, dict) else 1 | ||
for value in params.values() | ||
) | ||
|
||
|
||
parser = argparse.ArgumentParser(description='Process command line arguments.') | ||
parser.add_argument('--repo', type=str, required=True) | ||
args = parser.parse_args(sys.argv[1:]) | ||
|
||
repo = aim.Repo.from_path(args.repo) | ||
|
||
print('This script will collect basic statistics for Aim repository.') | ||
|
||
stats = {} | ||
|
||
all_runs = set(repo.list_all_runs()) | ||
unindexed_runs = set(repo.list_active_runs()) | ||
|
||
stats['runs_count'] = len(all_runs) | ||
stats['unindexed_runs_count'] = len(unindexed_runs) | ||
|
||
print('Collecting Runs info') | ||
metrics_count_list = [] | ||
params_count_list = [] | ||
for run in tqdm.tqdm(repo.iter_runs()): | ||
metrics_count_list.append(count_metrics(run)) | ||
params_count_list.append(count_params(run)) | ||
print('Done') | ||
|
||
stats['metrics_count'] = sum(metrics_count_list) | ||
stats['avg_metrics_per_run'] = round(sum(metrics_count_list) / len(all_runs), 2) | ||
stats['max_metrics_per_run'] = max(metrics_count_list) | ||
stats['avg_params_per_run'] = round(sum(params_count_list) / len(all_runs), 2) | ||
stats['max_params_per_run'] = max(params_count_list) | ||
|
||
|
||
print('Collecting query performance info') | ||
|
||
# Execute Run query with a single parameter access. | ||
# This is required to make sure there is a point lookup for each of the runs in the repo. | ||
run_query = 'run.hparams.lr < 0.001' | ||
|
||
start = time.time() | ||
for run in repo.query_runs(run_query, report_mode=0).iter_runs(): | ||
pass | ||
end = time.time() | ||
stats['runs_query_time'] = round(end - start, 4) | ||
|
||
# Execute Metric query with a single run parameter access and metric name check. | ||
# This is required to make sure there is a point lookup for each of the metrics in the repo. | ||
metric_query = 'run.hparams.lr < 0.001 and metric.name == "loss"' | ||
start = time.time() | ||
for metric in repo.query_metrics(metric_query, report_mode=0).iter(): | ||
pass | ||
end = time.time() | ||
stats['metrics_query_time'] = round(end - start, 4) | ||
print('Done') | ||
|
||
with open('aim_repo_stats.json', 'w') as fp: | ||
json.dump(stats, fp) | ||
print(f'Stats for Aim repo "{args.repo}" are available at `aim_repo_stats.json`.') |