SwanLab icon indicating copy to clipboard operation
SwanLab copied to clipboard

[REQUEST] 提供获取实验数据的代码接口

Open RongqinChen opened this issue 1 year ago • 4 comments

🤩 Features description [Please make everyone to understand it]

提供获取实验数据的代码接口,让用户可以通过代码下载指定项目名称的实验数据,方便用户更加高效的实验数据获取以及后续的数据分析。

👍 What problem does this feature solve

有了这个代码接口后,用户无需再逐一访问各个项目的网页,手动点击下载实验数据,这大大节省了时间和精力。 这样的设计不仅提升了用户体验,也提高了工作效率,例如更方便的计算一个项目中多个实验的各项指标统计值(如平均值、方差等),并轻松对比不同项目之间的实验效果。

👾 What does the proposed API look like

参考wandb的接口:

import pandas as pd
import numpy as np
import wandb
api = wandb.Api()

# Project is specified by <entity/project-name>
runs = api.runs(project_naame)

summary_list, config_list, name_list = [], [], []
for run in runs:
    # .summary contains the output keys/values for metrics like accuracy.
    #  We call ._json_dict to omit large files
    summary_list.append(run.summary._json_dict)

    # .config contains the hyperparameters.
    #  We remove special values that start with _.
    config_list.append({k: v for k, v in run.config.items() if not k.startswith('_')})

    # .name is the human-readable name of the run.
    name_list.append(run.name)

runs_df = pd.DataFrame({
    "summary": summary_list,
    "config": config_list,
    "name": name_list
})

# print(runs_df)
print(*summary_list, sep='\n')

best_test_metric_list = [
    summary['final/best_test_metric']
    for summary in summary_list
]
print(f"{np.mean(best_test_metric_list):.5f} +- {np.std(best_test_metric_list):.5f}")

runs_df.to_csv(f"{project_naame}.csv")

🚑 Any additional [like screenshots]

RongqinChen avatar Nov 13 '24 11:11 RongqinChen

会有的 🫠 不过我们现在上线了csv下载,希望能一定程度上解决您的需求

SAKURA-CAT avatar Dec 06 '24 11:12 SAKURA-CAT

我在使用的时候也遇到了类似的需求,这个功能是否能通过离线面板的http请求实现

Image

Sesame2 avatar Mar 25 '25 06:03 Sesame2

我在使用的时候也遇到了类似的需求,这个功能是否能通过离线面板的http请求实现

Image

离线看板是随意的,直接请求就好 云端版由于一些安全性问题还在开发中

SAKURA-CAT avatar Mar 26 '25 14:03 SAKURA-CAT

Similar to: https://github.com/SwanHubX/SwanLab/issues/1129

kites262 avatar Jul 17 '25 04:07 kites262