Skip to content

Commit e75aa98

Browse files
committed
integration mlflow
1 parent d5135c3 commit e75aa98

File tree

10 files changed

+171
-1
lines changed

10 files changed

+171
-1
lines changed

.vitepress/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ function sidebarIntegration(): DefaultTheme.SidebarItem[] {
177177
{ text: 'Keras', link: 'integration-keras' },
178178
{ text: 'LightGBM', link: 'integration-lightgbm'},
179179
{ text: 'LLaMA Factory', link: 'integration-llama-factory'},
180+
{ text: 'MLFlow', link: 'integration-mlflow'},
180181
{ text: 'MMEngine', link: 'integration-mmengine' },
181182
{ text: 'MMPretrain', link: 'integration-mmpretrain' },
182183
{ text: 'MMDetection', link: 'integration-mmdetection' },

.vitepress/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ function sidebarIntegration(): DefaultTheme.SidebarItem[] {
193193
{ text: 'Keras', link: 'integration-keras' },
194194
{ text: 'LightGBM', link: 'integration-lightgbm'},
195195
{ text: 'LLaMA Factory', link: 'integration-llama-factory'},
196+
{ text: 'MLFlow', link: 'integration-mlflow'},
196197
{ text: 'MMEngine', link: 'integration-mmengine' },
197198
{ text: 'MMPretrain', link: 'integration-mmpretrain' },
198199
{ text: 'MMDetection', link: 'integration-mmdetection' },
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# MLFlow
2+
3+
[MLFlow](https://github.com/mlflow/mlflow) is an open-source machine learning lifecycle management platform created and maintained by Databricks. It aims to assist data scientists and machine learning engineers in managing the entire lifecycle of machine learning projects more efficiently, including experiment tracking, model management, model deployment, and collaboration. MLflow is designed to be modular and can integrate with any machine learning library, framework, or tool.
4+
5+
![mlflow](./mlflow/logo.png)
6+
7+
:::warning Synchronization Tutorials for Other Tools
8+
9+
[TensorBoard](/zh/guide_cloud/integration/integration-tensorboard.md)
10+
[Weights & Biases](/zh/guide_cloud/integration/integration-wandb.md)
11+
:::
12+
13+
**You can convert projects from MLflow to SwanLab:**
14+
15+
::: info
16+
The current version only supports the conversion of scalar charts.
17+
:::
18+
19+
[[toc]]
20+
21+
## 1. Preparation
22+
23+
**Required: MLflow Service URL**
24+
25+
First, note down the **URL** of the MLflow service, such as `http://127.0.0.1:5000`.
26+
27+
> If the MLflow service is not yet started, you need to start it using the `mlflow ui` command and note down the URL.
28+
29+
**Optional: Experiment ID**
30+
31+
If you only want to convert a specific experiment, note down the experiment ID as shown in the image below.
32+
33+
![](./mlflow/ui-1.png)
34+
35+
## 2. Method 1: Command Line Conversion
36+
37+
Conversion Command:
38+
39+
```bash
40+
swanlab convert -t mlflow --mlflow-url <MLFLOW_URL> --mlflow-exp <MLFLOW_EXPERIMENT_ID>
41+
```
42+
43+
Supported parameters:
44+
45+
`-t`: Conversion type, options include wandb, tensorboard, and mlflow.
46+
`-p`: SwanLab project name.
47+
`-w`: SwanLab workspace name.
48+
`--cloud`: (bool) Whether the upload mode is "cloud", default is True.
49+
`-l`: Log directory path.
50+
`--mlflow-url`: URL of the MLflow service.
51+
`--mlflow-exp`: MLflow experiment ID.
52+
53+
If `--mlflow-exp` is not specified, all experiments under the specified project will be converted; if specified, only the designated experiment group will be converted.
54+
55+
## 3. Method 2: Conversion Within Code
56+
57+
```python
58+
from swanlab.converter import MLFLowConverter
59+
60+
mlflow_converter = MLFLowConverter(project="mlflow_converter")
61+
# mlflow_exp is optional
62+
mlflow_converter.run(tracking_uri="http://127.0.0.1:5000", experiment="1")
63+
```
64+
65+
The effect is consistent with command line conversion.
66+
67+
Parameters supported by `MLFLowConverter`:
68+
69+
`project`: SwanLab project name.
70+
`workspace`: SwanLab workspace name.
71+
`cloud`: (bool) Whether the upload mode is "cloud", default is True.
72+
`logdir`: ID of the wandb Run (a specific experiment under the project).
12.1 KB
Loading
170 KB
Loading
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# MLFlow
2+
3+
[MLFlow](https://github.com/mlflow/mlflow) 是一个开源的机器学习生命周期管理平台,由 Databricks 创建并维护。它旨在帮助数据科学家和机器学习工程师更高效地管理机器学习项目的整个生命周期,包括实验跟踪、模型管理、模型部署和协作。MLflow 的设计是模块化的,可以与任何机器学习库、框架或工具集成。
4+
5+
![mlflow](./mlflow/logo.png)
6+
7+
:::warning 其他工具的同步教程
8+
9+
- [TensorBoard](/zh/guide_cloud/integration/integration-tensorboard.md)
10+
- [Weights & Biases](/zh/guide_cloud/integration/integration-wandb.md)
11+
:::
12+
13+
**你可以用将MLflow上的项目转换到SwanLab:**
14+
15+
::: info
16+
在当前版本暂仅支持转换标量图表。
17+
:::
18+
19+
[[toc]]
20+
21+
22+
## 1. 准备工作
23+
24+
**(必须)mlflow服务的url链接**
25+
26+
首先,需要记下mlflow服务的**url链接**,如`http://127.0.0.1:5000`
27+
28+
> 如果还没有启动mlflow服务,那么需要使用`mlflow ui`命令启动服务,并记下url链接。
29+
30+
**(可选)实验ID**
31+
32+
如果你只想转换其中的一组实验,那么在下图所示的地方,记下该实验ID。
33+
34+
![](./mlflow/ui-1.png)
35+
36+
## 2. 方式一:命令行转换
37+
38+
转换命令行:
39+
40+
```bash
41+
swanlab convert -t mlflow --mlflow-url <MLFLOW_URL> --mlflow-exp <MLFLOW_EXPERIMENT_ID>
42+
```
43+
44+
支持的参数如下:
45+
46+
- `-t`: 转换类型,可选wandb、tensorboard和mlflow。
47+
- `-p`: SwanLab项目名。
48+
- `-w`: SwanLab工作空间名。
49+
- `--cloud`: (bool) 是否上传模式为"cloud",默认为True
50+
- `-l`: logdir路径。
51+
- `--mlflow-url`: mlflow服务的url链接。
52+
- `--mlflow-exp`: mlflow实验ID。
53+
54+
如果不填写`--mlflow-exp`,则会将指定项目下的全部实验进行转换;如果填写,则只转换指定的实验组。
55+
56+
## 3. 方式二:代码内转换
57+
58+
```python
59+
from swanlab.converter import MLFLowConverter
60+
61+
mlflow_converter = MLFLowConverter(project="mlflow_converter")
62+
# mlflow_exp可选
63+
mlflow_converter.run(tracking_uri="http://127.0.0.1:5000", experiment="1")
64+
```
65+
66+
效果与命令行转换一致。
67+
68+
`MLFLowConverter`支持的参数:
69+
70+
- `project`: SwanLab项目名。
71+
- `workspace`: SwanLab工作空间名。
72+
- `cloud`: (bool) 是否上传模式为"cloud",默认为True。
73+
- `logdir`: wandb Run(项目下的某一个实验)的id。

zh/guide_cloud/integration/integration-tensorboard.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:::warning 其他工具的同步教程
88

99
- [Wandb](/zh/guide_cloud/integration/integration-wandb.md)
10+
- [MLFlow](/zh/guide_cloud/integration/integration-mlflow.md)
1011
:::
1112

1213
**你可以用两种方式将使用Tensorboard跟踪的项目同步到SwanLab:**
@@ -129,6 +130,15 @@ for epoch in range(2, epochs):
129130
swanlab convert -t tensorboard --tb_logdir [TFEVENT_LOGDIR]
130131
```
131132

133+
支持的参数如下:
134+
135+
- `-t`: 转换类型,可选wandb、tensorboard和mlflow。
136+
- `-p`: SwanLab项目名。
137+
- `-w`: SwanLab工作空间名。
138+
- `--cloud`: (bool) 是否上传模式为"cloud",默认为True
139+
- `-l`: logdir路径。
140+
- `--tb_logdir`: Tensorboard日志文件路径。
141+
132142
这里的`[TFEVENT_LOGDIR]`是指你先前用Tensorboard记录实验时,生成的日志文件路径。
133143

134144
SwanLab Converter将会自动检测文件路径及其子目录下的`tfevent`文件(默认子目录深度为3),并为每个`tfevent`文件创建一个SwanLab实验。

zh/guide_cloud/integration/integration-wandb.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Weights & Biases (Wandb) 是一个用于机器学习和深度学习项目的实
77
:::warning 其他工具的同步教程
88

99
- [TensorBoard](/zh/guide_cloud/integration/integration-tensorboard.md)
10+
- [MLFlow](/zh/guide_cloud/integration/integration-mlflow.md)
1011
:::
1112

1213
**你可以用两种方式将Wandb上的项目同步到SwanLab:**
@@ -108,6 +109,10 @@ swanlab convert -t wandb --wb-project [WANDB_PROJECT_NAME] --wb-entity [WANDB_EN
108109
支持的参数如下:
109110

110111
- `-t`: 转换类型,可选wandb与tensorboard。
112+
- `-p`: SwanLab项目名。
113+
- `-w`: SwanLab工作空间名。
114+
- `--cloud`: (bool) 是否上传模式为"cloud",默认为True
115+
- `-l`: logdir路径。
111116
- `--wb-project`:待转换的wandb项目名。
112117
- `--wb-entity`:wandb项目所在的空间名。
113118
- `--wb-runid`: wandb Run(项目下的某一个实验)的id。
@@ -123,4 +128,12 @@ wb_converter = WandbConverter()
123128
# wb_runid可选
124129
wb_converter.run(wb_project="WANDB_PROJECT_NAME", wb_entity="WANDB_USERNAME")
125130
```
126-
效果与命令行转换一致。
131+
132+
效果与命令行转换一致。
133+
134+
`WandbConverter`支持的参数:
135+
136+
- `project`: SwanLab项目名。
137+
- `workspace`: SwanLab工作空间名。
138+
- `cloud`: (bool) 是否上传模式为"cloud",默认为True。
139+
- `logdir`: wandb Run(项目下的某一个实验)的id。
12.1 KB
Loading
170 KB
Loading

0 commit comments

Comments
 (0)