Skip to content

Commit

Permalink
docs: en experiment track
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Dec 2, 2024
1 parent fb811a9 commit 039598a
Show file tree
Hide file tree
Showing 13 changed files with 932 additions and 21 deletions.
43 changes: 22 additions & 21 deletions .vitepress/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const en = defineConfig({

// 最后更新于配置
lastUpdated: {
text: '更新于',
text: 'Updated at',
formatOptions: {
dateStyle: 'full',
timeStyle: 'medium'
Expand All @@ -58,12 +58,12 @@ export const en = defineConfig({
// 编辑此页配置
editLink: {
pattern: 'https://github.com/swanhubx/swanlab-docs/edit/main/:path',
text: '在GitHub编辑此页面'
text: 'Edit this page on GitHub'
},

// 侧边栏配置
outline: {
label: '本页目录',
label: 'On this page',
level: 'deep',
},

Expand Down Expand Up @@ -98,27 +98,28 @@ function sidebarGuideCloud(): DefaultTheme.SidebarItem[] {
{ text: 'Changelog', link: 'general/changelog' }
]
},
{
text: '📚 Experiment Track',
// collapsed: false,
items: [
{ text: 'What is experiment tracking?', link: 'experiment_track/what-is-experiment-track' },
{ text: 'Create an experiment', link: 'experiment_track/create-experiment' },
{ text: 'Create by config file', link: 'experiment_track/create-experiment-by-configfile' },
{ text: 'Set config', link: 'experiment_track/set-experiment-config' },
{ text: 'Log metric', link: 'experiment_track/log-experiment-metric' },
{ text: 'Log media metric', link: 'experiment_track/log-media' },
{ text: 'View result', link: 'experiment_track/view-result' },
{ text: 'Finish experiment', link: 'experiment_track/finish-experiment' },
{ text: 'Jupyter Notebook', link: 'experiment_track/jupyter-notebook' },
{ text: 'Limitations and Performance', link: 'experiment_track/limit-and-performance' },
{ text: 'Experiment metadata', link: 'experiment_track/experiment-metadata' },
{ text: 'FAQ', link: 'experiment_track/FAQ' },
]
},
]
}

// {
// text: '📚 实验跟踪',
// // collapsed: false,
// items: [
// { text: '什么是实验跟踪', link: 'experiment_track/what-is-experiment-track' },
// { text: '创建一个实验', link: 'experiment_track/create-experiment' },
// { text: '用配置文件创建实验', link: 'experiment_track/create-experiment-by-configfile' },
// { text: '设置实验配置', link: 'experiment_track/set-experiment-config' },
// { text: '记录指标', link: 'experiment_track/log-experiment-metric' },
// { text: '记录多媒体数据', link: 'experiment_track/log-media' },
// { text: '查看实验结果', link: 'experiment_track/view-result' },
// { text: '结束一个实验', link: 'experiment_track/finish-experiment' },
// { text: '用Jupyter Notebook跟踪实验', link: 'experiment_track/jupyter-notebook' },
// { text: '限制与性能', link: 'experiment_track/limit-and-performance' },
// { text: '实验元数据', link: 'experiment_track/experiment-metadata' },
// { text: 'FAQ', link: 'experiment_track/FAQ' },
// ]
// },

// {
// text: '💻 自托管',
// // collapsed: false,
Expand Down
46 changes: 46 additions & 0 deletions en/guide_cloud/experiment_track/FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# FAQ

## 登录时,API Key为什么输入不进去?

见此回答:[链接](https://www.zhihu.com/question/720308649/answer/25076837539)


## 如何从一个脚本启动多个实验?

在多次创建实验之间增加`swanlab.finish()`即可。

执行了`swanlab.finish()`之后,再次执行`swanlab.init()`就会创建新的实验;
如果不执行`swanlab.finish()`的情况下,再次执行`swanlab.init()`,将无视此次执行。

## 如何在训练时关闭swanlab记录(Debug调试)?

`swanlab.init``mode`参数设置为disabled,就可以不创建实验以及不写入数据。

```python
swanlab.init(mode='disabled')
```


## 本地的训练已经结束,但SwanLab UI上仍然在运行中,要怎么改变状态?

点击实验名旁边的终止按钮,会将实验状态从“进行中”转为“中断”,并停止接收数据的上传。

![stop](/assets/stop.png)


## 如何查看折线图的局部细节?

放大折线图,长按鼠标划过目标的区域,即可放大查看该区域。

![details](/assets/faq-chart-details.png)

双击区域后复原。

## 如何取消实验的后缀名?

```python
swanlab.init(suffix=None)
```

ps: 在0.3.22版本以后,不再自动为实验名添加后缀。

137 changes: 137 additions & 0 deletions en/guide_cloud/experiment_track/create-experiment-by-configfile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Create Experiment with Configuration File

This section will introduce how to create SwanLab experiments using configuration files in json or yaml format.

## Load Configuration File with swanlab.config

The `config` parameter of `swanlab.init` supports passing the path of a configuration file in json or yaml format, and parses the configuration file into a dictionary for experiment creation.

### Using json File

Below is an example of a configuration file in json format:

```json
{
"epochs": 20,
"learning-rate": 0.001
}
```

Pass the path of the configuration file to the `config` parameter, it will parse the configuration file into a dictionary:

```python
swanlab.init(config="swanlab-init-config.json")
# Equivalent to swanlab.init(config={"epochs": 20, "learning-rate": 0.001})
```

### Using yaml File

Below is an example of a configuration file in yaml format:

```yaml
epochs: 20
learning-rate: 0.001
```
Pass the path of the configuration file to the `config` parameter, it will parse the configuration file into a dictionary:

```python
swanlab.init(config="swanlab-init-config.yaml")
# Equivalent to swanlab.init(config={"epochs": 20, "learning-rate": 0.001})
```

## Load Configuration File with swanlab.init

The `load` parameter of `swanlab.init` supports passing the path of a configuration file in json or yaml format, and parses the configuration file for experiment creation.

### Using json File

Below is an example of a configuration file in json format:

```json
{
"project": "cat-dog-classification",
"experiment_name": "Resnet50",
"description": "My first AI experiment",
"config": {
"epochs": 20,
"learning-rate": 0.001
}
}
```

Pass the path of the configuration file to the `load` parameter, it will parse the configuration file to initialize the experiment:

```python
swanlab.init(load="swanlab-config.json")
# Equivalent to
# swanlab.init(
# project="cat-dog-classification",
# experiment_name="Resnet50",
# description="My first AI experiment",
# config={
# "epochs": 20,
# "learning-rate": 0.001
# }
# )
```

### Using yaml File

Below is an example of a configuration file in yaml format:

```yaml
project: cat-dog-classification
experiment_name: Resnet50
description: My first AI experiment
config:
epochs: 20
learning-rate: 0.001
```

Pass the path of the configuration file to the `load` parameter, it will parse the configuration file to initialize the experiment:

```python
swanlab.init(load="swanlab-config.yaml")
# Equivalent to
# swanlab.init(
# project="cat-dog-classification",
# experiment_name="Resnet50",
# description="My first AI experiment",
# config={
# "epochs": 20,
# "learning-rate": 0.001
# }
# )
```

## FAQ

### 1. Is the configuration file naming fixed?

The naming of the configuration file is free, but it is recommended to use `swanlab-init` and `swanlab-init-config` as the configuration names.

### 2. What is the relationship between the parameters in the configuration file and the script?

The priority of the parameters in the script is higher than that in the configuration file, that is, the parameters in the script will override the parameters in the configuration file.

For example, there is a yaml configuration file and a code snippet below:

```yaml
project: cat-dog-classification
experiment_name: Resnet50
description: My first AI experiment
config:
epochs: 20
learning-rate: 0.001
```

```python
swanlab.init(
experiment_name="resnet101",
config={"epochs": 30},
load="swanlab-init.yaml"
)
```

The final `experiment_name` is resnet101, and `config` is {"epochs": 30}.
Loading

0 comments on commit 039598a

Please sign in to comment.