tools.md 2.01 KB
Newer Older
Leymore's avatar
Leymore committed
1
2
3
4
# 实用工具

## Prompt Viewer

Tong Gao's avatar
Tong Gao committed
5
本工具允许你在不启动完整训练流程的情况下,直接查看生成的 prompt。如果传入的配置仅为数据集配置(如 `configs/datasets/nq/nq_gen_3dcea1.py`),则展示数据集配置中定义的原始 prompt。若为完整的评测配置(包含模型和数据集),则会展示所选模型运行时实际接收到的 prompt。
Leymore's avatar
Leymore committed
6
7
8
9

运行方式:

```bash
Tong Gao's avatar
Tong Gao committed
10
python tools/prompt_viewer.py CONFIG_PATH [-n] [-a] [-p PATTERN]
Leymore's avatar
Leymore committed
11
12
```

Tong Gao's avatar
Tong Gao committed
13
14
15
16
- `-n`: 不进入交互模式,默认选择第一个 model (如有)和 dataset。
- `-a`: 查看配置中所有模型和所有数据集组合接收到的 prompt。
- `-p PATTERN`: 不进入交互模式,选择所有与传入正则表达式匹配的数据集。

Leymore's avatar
Leymore committed
17
18
## Case Analyzer

Tong Gao's avatar
Tong Gao committed
19
本工具在已有评测结果的基础上,产出推理错误样本以及带有标注信息的全量样本。
Leymore's avatar
Leymore committed
20
21
22
23

运行方式:

```bash
Tong Gao's avatar
Tong Gao committed
24
python tools/case_analyzer.py CONFIG_PATH [-w WORK_DIR]
Leymore's avatar
Leymore committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
```

- `-w`:工作路径,默认为 `'./outputs/default'`

## Lark Bot

用户可以通过配置飞书机器人,实现任务状态的实时监控。飞书机器人的设置文档请[参考这里](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN?lang=zh-CN#7a28964d)

配置方式:

- 打开 `configs/secrets.py` 文件,并在文件中加入以下行:

  ```python
  lark_bot_url = 'YOUR_WEBHOOK_URL'
  ```

  通常, Webhook URL 格式如 https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx 。

- 在完整的评测配置中继承该文件:

  ```python
    _base_ = [
        'secrets.py',
        ...
    ]
  ```

  实例可见 `configs/eval.py`

- 为了避免机器人频繁发消息形成骚扰,默认运行时状态不会自动上报。有需要时,可以通过 `-l``--lark` 启动状态上报:

  ```bash
Tong Gao's avatar
Tong Gao committed
57
  python run.py configs/eval_demo.py -l
Leymore's avatar
Leymore committed
58
59
  ```

Tong Gao's avatar
Tong Gao committed
60
## API Model Tester
Leymore's avatar
Leymore committed
61

Tong Gao's avatar
Tong Gao committed
62
本工具可以快速测试 API 模型的功能是否正常。
Leymore's avatar
Leymore committed
63
64
65
66

运行方式:

```bash
Tong Gao's avatar
Tong Gao committed
67
python tools/test_api_model.py [CONFIG_PATH] -n
Leymore's avatar
Leymore committed
68
```