Skip to content

Commit 52106eb

Browse files
MaiziXiaostephen-nju
authored andcommitted
[Refactor] Code refactoarization (open-compass#1831)
* Update * fix lint * update * fix lint
1 parent 54a7a0c commit 52106eb

File tree

1,762 files changed

+1939
-66352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,762 files changed

+1939
-66352
lines changed

.pre-commit-config-zh-cn.yaml

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
exclude: |
22
(?x)^(
33
tests/data/|
4+
tests/dataset/|
45
opencompass/models/internal/|
56
opencompass/utils/internal/|
67
opencompass/openicl/icl_evaluator/hf_metrics/|
@@ -10,12 +11,9 @@ exclude: |
1011
opencompass/datasets/teval/|
1112
opencompass/datasets/NPHardEval/|
1213
opencompass/datasets/TheoremQA|
14+
opencompass/datasets/subjective/mtbench101.py|
1315
docs/zh_cn/advanced_guides/compassbench_intro.md |
1416
docs/zh_cn/advanced_guides/compassbench_v2_0.md |
15-
opencompass/configs/datasets/ |
16-
opencompass/configs/models/|
17-
opencompass/configs/summarizers/|
18-
opencompass/configs/dataset_collections/ |
1917
opencompass/utils/datasets.py |
2018
opencompass/utils/datasets_info.py
2119
)
@@ -26,26 +24,26 @@ repos:
2624
- id: flake8
2725
exclude: |
2826
(?x)^(
29-
configs/ |
30-
example_scripts/
27+
opencompass/configs/|
28+
examples/
3129
)
3230
- repo: https://gitee.com/openmmlab/mirrors-isort
3331
rev: 5.11.5
3432
hooks:
3533
- id: isort
3634
exclude: |
3735
(?x)^(
38-
configs/ |
39-
example_scripts/
36+
opencompass/configs/|
37+
examples/
4038
)
4139
- repo: https://gitee.com/openmmlab/mirrors-yapf
4240
rev: v0.32.0
4341
hooks:
4442
- id: yapf
4543
exclude: |
4644
(?x)^(
47-
configs/ |
48-
example_scripts/
45+
opencompass/configs/|
46+
examples/
4947
)
5048
- repo: https://gitee.com/openmmlab/mirrors-codespell
5149
rev: v2.2.1
@@ -55,9 +53,8 @@ repos:
5553
(?x)^(
5654
.*\.jsonl|
5755
.*\.md.template|
58-
configs/ |
5956
opencompass/configs/ |
60-
example_scripts/
57+
examples/
6158
)
6259
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
6360
rev: v4.3.0
@@ -67,15 +64,13 @@ repos:
6764
(?x)^(
6865
dicts/|
6966
projects/.*?/dicts/|
70-
configs/.*?/.*\.txt
7167
)
7268
- id: check-yaml
7369
- id: end-of-file-fixer
7470
exclude: |
7571
(?x)^(
7672
dicts/|
7773
projects/.*?/dicts/|
78-
configs/.*?/.*\.txt
7974
)
8075
- id: requirements-txt-fixer
8176
- id: double-quote-string-fixer
@@ -107,7 +102,7 @@ repos:
107102
language: script
108103
pass_filenames: true
109104
require_serial: true
110-
files: ^configs/datasets
105+
files: ^opencompass/configs/datasets
111106
- repo: local
112107
hooks:
113108
- id: update-dataset-suffix-pacakge
@@ -120,41 +115,6 @@ repos:
120115
args:
121116
- --root_folder
122117
- opencompass/configs/datasets
123-
- repo: local
124-
hooks:
125-
- id: compare-configs-datasets
126-
name: compare configs datasets
127-
entry: ./tools/compare_configs.py
128-
language: script
129-
pass_filenames: false
130-
# require_serial: true
131-
args:
132-
- configs/datasets
133-
- opencompass/configs/datasets
134-
- repo: local
135-
hooks:
136-
- id: compare-configs-models
137-
name: compare configs models
138-
entry: ./tools/compare_configs.py
139-
language: script
140-
pass_filenames: false
141-
# require_serial: true
142-
args:
143-
- configs/models
144-
- opencompass/configs/models
145-
- --ignore
146-
- llama
147-
- repo: local
148-
hooks:
149-
- id: compare-configs-summarizers
150-
name: compare configs summarizers
151-
entry: ./tools/compare_configs.py
152-
language: script
153-
pass_filenames: false
154-
# require_serial: true
155-
args:
156-
- configs/summarizers
157-
- opencompass/configs/summarizers
158118
# - repo: https://github.com/open-mmlab/pre-commit-hooks
159119
# rev: v0.2.0 # Use the ref you want to point at
160120
# hooks:

.pre-commit-config.yaml

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ exclude: |
1414
opencompass/datasets/subjective/mtbench101.py|
1515
docs/zh_cn/advanced_guides/compassbench_intro.md |
1616
docs/zh_cn/advanced_guides/compassbench_v2_0.md |
17-
opencompass/configs/datasets/ |
18-
opencompass/configs/models/|
19-
opencompass/configs/summarizers/ |
20-
opencompass/configs/dataset_collections/ |
2117
opencompass/utils/datasets.py |
2218
opencompass/utils/datasets_info.py
2319
)
@@ -28,26 +24,26 @@ repos:
2824
- id: flake8
2925
exclude: |
3026
(?x)^(
31-
configs/ |
32-
example_scripts/
27+
opencompass/configs/|
28+
examples/
3329
)
3430
- repo: https://github.com/PyCQA/isort
3531
rev: 5.11.5
3632
hooks:
3733
- id: isort
3834
exclude: |
3935
(?x)^(
40-
configs/ |
41-
example_scripts/
36+
opencompass/configs/|
37+
examples/
4238
)
4339
- repo: https://github.com/pre-commit/mirrors-yapf
4440
rev: v0.32.0
4541
hooks:
4642
- id: yapf
4743
exclude: |
4844
(?x)^(
49-
configs/ |
50-
example_scripts/
45+
opencompass/configs/|
46+
examples/
5147
)
5248
- repo: https://github.com/codespell-project/codespell
5349
rev: v2.2.1
@@ -57,9 +53,8 @@ repos:
5753
(?x)^(
5854
.*\.jsonl|
5955
.*\.md.template|
60-
configs/ |
6156
opencompass/configs/ |
62-
example_scripts/
57+
examples/
6358
)
6459
- repo: https://github.com/pre-commit/pre-commit-hooks
6560
rev: v4.3.0
@@ -69,15 +64,13 @@ repos:
6964
(?x)^(
7065
dicts/|
7166
projects/.*?/dicts/|
72-
configs/.*?/.*\.txt
7367
)
7468
- id: check-yaml
7569
- id: end-of-file-fixer
7670
exclude: |
7771
(?x)^(
7872
dicts/|
7973
projects/.*?/dicts/|
80-
configs/.*?/.*\.txt
8174
)
8275
- id: requirements-txt-fixer
8376
- id: double-quote-string-fixer
@@ -109,7 +102,7 @@ repos:
109102
language: script
110103
pass_filenames: true
111104
require_serial: true
112-
files: ^configs/datasets
105+
files: ^opencompass/configs/datasets
113106
- repo: local
114107
hooks:
115108
- id: update-dataset-suffix-pacakge
@@ -122,42 +115,6 @@ repos:
122115
args:
123116
- --root_folder
124117
- opencompass/configs/datasets
125-
- repo: local
126-
hooks:
127-
- id: compare-configs-datasets
128-
name: compare configs datasets
129-
entry: ./tools/compare_configs.py
130-
language: script
131-
pass_filenames: false
132-
# require_serial: true
133-
args:
134-
- configs/datasets
135-
- opencompass/configs/datasets
136-
- repo: local
137-
hooks:
138-
- id: compare-configs-models
139-
name: compare configs models
140-
entry: ./tools/compare_configs.py
141-
language: script
142-
pass_filenames: false
143-
# require_serial: true
144-
args:
145-
- configs/models
146-
- opencompass/configs/models
147-
- --ignore
148-
- llama
149-
- repo: local
150-
hooks:
151-
- id: compare-configs-summarizers
152-
name: compare configs summarizers
153-
entry: ./tools/compare_configs.py
154-
language: script
155-
pass_filenames: false
156-
# require_serial: true
157-
args:
158-
- configs/summarizers
159-
- opencompass/configs/summarizers
160-
161118
# - repo: https://github.com/open-mmlab/pre-commit-hooks
162119
# rev: v0.2.0 # Use the ref you want to point at
163120
# hooks:

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ After ensuring that OpenCompass is installed correctly according to the above st
182182
opencompass --models hf_internlm2_5_1_8b_chat --datasets demo_gsm8k_chat_gen
183183

184184
# Python scripts
185-
opencompass ./configs/eval_chat_demo.py
185+
opencompass examples/eval_chat_demo.py
186186
```
187187

188-
You can find more script examples under [configs](./configs) folder.
188+
You can find more script examples under [examples](./examples) folder.
189189

190190
- API evaluation
191191

@@ -197,7 +197,7 @@ After ensuring that OpenCompass is installed correctly according to the above st
197197
opencompass --models gpt_4o_2024_05_13 --datasets demo_gsm8k_chat_gen
198198

199199
# Python scripts
200-
opencompass ./configs/eval_api_demo.py
200+
opencompass examples/eval_api_demo.py
201201

202202
# You can use o1_mini_2024_09_12/o1_preview_2024_09_12 for o1 models, we set max_completion_tokens=8192 as default.
203203
```
@@ -211,7 +211,7 @@ After ensuring that OpenCompass is installed correctly according to the above st
211211
opencompass --models hf_internlm2_5_1_8b_chat --datasets demo_gsm8k_chat_gen -a lmdeploy
212212

213213
# Python scripts
214-
opencompass ./configs/eval_lmdeploy_demo.py
214+
opencompass examples/eval_lmdeploy_demo.py
215215
```
216216

217217
- Supported Models

README_zh-CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,17 @@ humaneval, triviaqa, commonsenseqa, tydiqa, strategyqa, cmmlu, lambada, piqa, ce
169169

170170
- ### 首次评测
171171

172-
OpenCompass 支持通过命令行界面 (CLI) 或 Python 脚本来设置配置。对于简单的评估设置,我们推荐使用 CLI;而对于更复杂的评估,则建议使用脚本方式。你可以在configs文件夹下找到更多脚本示例
172+
OpenCompass 支持通过命令行界面 (CLI) 或 Python 脚本来设置配置。对于简单的评估设置,我们推荐使用 CLI;而对于更复杂的评估,则建议使用脚本方式。你可以在examples文件夹下找到更多脚本示例
173173

174174
```bash
175175
# 命令行界面 (CLI)
176176
opencompass --models hf_internlm2_5_1_8b_chat --datasets demo_gsm8k_chat_gen
177177

178178
# Python 脚本
179-
opencompass ./configs/eval_chat_demo.py
179+
opencompass examples/eval_chat_demo.py
180180
```
181181

182-
你可以在[configs](./configs) 文件夹下找到更多的脚本示例。
182+
你可以在[examples](./examples) 文件夹下找到更多的脚本示例。
183183

184184
- ### API评测
185185

@@ -191,7 +191,7 @@ humaneval, triviaqa, commonsenseqa, tydiqa, strategyqa, cmmlu, lambada, piqa, ce
191191
opencompass --models gpt_4o_2024_05_13 --datasets demo_gsm8k_chat_gen
192192

193193
# Python 脚本
194-
opencompass ./configs/eval_api_demo.py
194+
opencompass examples/eval_api_demo.py
195195

196196

197197
# 现已支持 o1_mini_2024_09_12/o1_preview_2024_09_12 模型, 默认情况下 max_completion_tokens=8192.

configs/api_examples/eval_api_360.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)