aim-proxy/encode-3.21.py

104 lines
3.1 KiB
Python

from aim import Repo
from aim.sdk.types import QueryReportMode
# 配置 Aim repository 路径
repo_path = 'aim://172.20.32.181:30038'
# 打开 Aim repository
repo = Repo(repo_path)
#
# # 打印 run 的详细信息
# # def print_run_details(run):
# # if run is None:
# # print("Run not found.")
# # return
# #
# # # 打印 Run 对象的所有属性
# # print("Run object attributes:")
# # for attr in dir(run):
# # if not attr.startswith('_'):
# # print(attr)
# #
# # # 假设 Run 对象有以下属性
# # print(f"Run ID: {run.hash}")
# # print(f"Experiment: {run.experiment}")
# # print(f"Description: {run.description}")
# # print(f"Created at: {run.creation_time}")
# # print(f"Tags: {run.tags}")
# #
# # # # 打印所有参数
# # # print("\nParameters:")
# # # if hasattr(run, 'params'):
# # # for param in run.params.keys():
# # # print(f"{param}: {run.params[param]}")
# # # else:
# # # print("No parameters found.")
# # #
# # # # 打印所有metrics
# # # print("\nMetrics:")
# # # if hasattr(run, 'metrics'):
# # # for metric in run.metrics.keys():
# # # print(f"{metric}: {run.metrics[metric].values()}")
# # # else:
# # # print("No metrics found.")
# # # 打印run的详细信息
# #
#
# # 查询指定实验的 runs
# experiment_name = "experiment-13"
# #runs = repo.query_runs('run.experiment=="experiment-88888"')
# runs = repo.query_runs()
#
# if runs is None:
# print("No runs found.")
# exit()
# else:
# print("query_runs result success.")
#
# # result = repo.get_run("45311bf77ccb4ae683a7e630")
# # print_run_details(result)
# # # 查询指定的 runs
# # hashes_to_find = ["581c75204d134704b3c9ac27", "3dfdf9b3a4b0453790c8c7d0", "34fd862f49f64d9c8c12aa4a"]
# # runs = repo.query_runs(f"run.hash in {hashes_to_find}")
# # # repo.delete_run("9cd6b4ed0e7848779274ad4f")
# # # 获取查询到的 runs 的 run.hash 并以数组形式返回
# #
#
# count = list(runs).count(None)
# print(f"Found {count} runs.")
#
#
# for run in runs:
# if run is None:
# print("No runs found.")
# exit()
# else:
# print("query_runs result success.")
# print("run:", run.hash)
# # print(run.hash)
#
# print("query_runs result end.")
experiment_name = "experiment-13"
query_res = repo.query_runs(query='', paginated=True).iter_runs()
runs = [item.run for item in query_res]
for run in runs:
# filtered_runs = []
# for run in repo.iter_runs():
# if run.experiment == experiment_name:
# filtered_runs.append(run)
# print("run:", run.hash)
# # 获取所有存储的参数
# for metric_name, metric_context, metric_run in run.iter_metrics_info():
# print("metric_name:", metric_name)
# print("metric_context:", metric_context)
# print("metric_run:", metric_run)
# #获取指定参数的具体值
# metric_value = run.get_metric(metric_name, metric_context)
# print("metric_value:", metric_value)
# # 获取所有存储的图像