Skip to content

Commit 9e169a6

Browse files
Jintao-Huanghuangjintao
andauthored
update docs table (modelscope#1021)
--------- Co-authored-by: huangjintao <[email protected]>
1 parent 2492338 commit 9e169a6

File tree

6 files changed

+363
-322
lines changed

6 files changed

+363
-322
lines changed

docs/source/LLM/支持的模型和数据集.md

Lines changed: 52 additions & 44 deletions
Large diffs are not rendered by default.

docs/source_en/LLM/Supported-models-datasets.md

Lines changed: 52 additions & 44 deletions
Large diffs are not rendered by default.

scripts/utils/run_dataset_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def write_dataset_info() -> None:
5252
dataset_info = DATASET_MAPPING[dataset_name]
5353
tags = dataset_info.get('tags', [])
5454
subsets = dataset_info.get('subsets', [])
55-
subsets = ','.join(subsets)
55+
subsets = '<br>'.join(subsets)
5656
if 'audio' in tags:
5757
template = mapping['audio']
5858
elif 'vision' in tags:

scripts/utils/run_model_info.py

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
def get_model_info_table() -> List[str]:
77
fpaths = ['docs/source/LLM/支持的模型和数据集.md', 'docs/source_en/LLM/Supported-models-datasets.md']
8-
end_words = ['## 数据集', '## Datasets']
8+
end_words = [['### 多模态大模型', '## 数据集'], ['### MLLM', '## Datasets']]
99
model_name_list = ModelType.get_model_name_list()
10-
result = ('| Model Type | Model ID | Default Lora Target Modules | Default Template |'
11-
' Support Flash Attn | Support VLLM | Requires | Tags | HF Model ID |\n'
12-
'| --------- | -------- | --------------------------- | ---------------- |'
13-
' ------------------ | ------------ | -------- | ---- | ----------- |\n')
14-
res: List[str] = []
10+
result = [
11+
'| Model Type | Model ID | Default Lora Target Modules | Default Template |'
12+
' Support Flash Attn | Support VLLM | Requires | Tags | HF Model ID |\n'
13+
'| --------- | -------- | --------------------------- | ---------------- |'
14+
' ------------------ | ------------ | -------- | ---- | ----------- |\n'
15+
] * 2
16+
res_llm: List[str] = []
17+
res_mllm: List[str] = []
1518
bool_mapping = {True: '&#x2714;', False: '&#x2718;'}
1619
for model_name in model_name_list:
1720
model_info = MODEL_MAPPING[model_name]
@@ -24,6 +27,11 @@ def get_model_info_table() -> List[str]:
2427
support_vllm = bool_mapping[support_vllm]
2528
requires = ', '.join(model_info['requires'])
2629
tags = model_info.get('tags', [])
30+
if 'multi-modal' in tags:
31+
tags.remove('multi-modal')
32+
is_multi_modal = True
33+
else:
34+
is_multi_modal = False
2735
tags_str = ', '.join(tags)
2836
if len(tags_str) == 0:
2937
tags_str = '-'
@@ -34,24 +42,32 @@ def get_model_info_table() -> List[str]:
3442
model_name, model_id, lora_target_modules, template, support_flash_attn, support_vllm, requires, tags_str,
3543
hf_model_id
3644
]
37-
res.append(r)
38-
text = ''
39-
for r in res:
40-
ms_url = f'https://modelscope.cn/models/{r[1]}/summary'
41-
if r[8] != '-':
42-
hf_url = f'https://huggingface.co/{r[8]}'
43-
hf_model_id_str = f'[{r[8]}]({hf_url})'
45+
if is_multi_modal:
46+
res_mllm.append(r)
4447
else:
45-
hf_model_id_str = '-'
46-
text += f'|{r[0]}|[{r[1]}]({ms_url})|{r[2]}|{r[3]}|{r[4]}|{r[5]}|{r[6]}|{r[7]}|{hf_model_id_str}|\n'
47-
print(f'模型总数: {len(res)}')
48-
result += text
49-
for idx, fpath in enumerate(fpaths):
48+
res_llm.append(r)
49+
print(f'LLM总数: {len(res_llm)}, MLLM总数: {len(res_mllm)}')
50+
text = ['', ''] # llm, mllm
51+
for i, res in enumerate([res_llm, res_mllm]):
52+
for r in res:
53+
ms_url = f'https://modelscope.cn/models/{r[1]}/summary'
54+
if r[8] != '-':
55+
hf_url = f'https://huggingface.co/{r[8]}'
56+
hf_model_id_str = f'[{r[8]}]({hf_url})'
57+
else:
58+
hf_model_id_str = '-'
59+
text[i] += f'|{r[0]}|[{r[1]}]({ms_url})|{r[2]}|{r[3]}|{r[4]}|{r[5]}|{r[6]}|{r[7]}|{hf_model_id_str}|\n'
60+
result[i] += text[i]
61+
62+
for i, fpath in enumerate(fpaths):
5063
with open(fpath, 'r') as f:
5164
text = f.read()
52-
start_idx = text.find('| Model Type |')
53-
end_idx = text.find(end_words[idx])
54-
output = text[:start_idx] + result + '\n\n' + text[end_idx:]
65+
llm_start_idx = text.find('| Model Type |')
66+
mllm_start_idx = text[llm_start_idx + 1:].find('| Model Type |') + llm_start_idx + 1
67+
llm_end_idx = text.find(end_words[i][0])
68+
mllm_end_idx = text.find(end_words[i][1])
69+
output = text[:llm_start_idx] + result[0] + '\n\n' + text[llm_end_idx:mllm_start_idx] + result[
70+
1] + '\n\n' + text[mllm_end_idx:]
5571
with open(fpath, 'w') as f:
5672
text = f.write(output)
5773
return res

0 commit comments

Comments
 (0)