()
| 34 | |
| 35 | |
| 36 | def get_model_info_table(): |
| 37 | global supported_mcore_model_types |
| 38 | fpaths = [ |
| 39 | 'docs/source/Instruction/Supported-models-and-datasets.md', |
| 40 | 'docs/source_en/Instruction/Supported-models-and-datasets.md' |
| 41 | ] |
| 42 | cache_mapping = get_cache_mapping(fpaths[0]) |
| 43 | end_words = [['### 多模态大模型', '## 数据集'], ['### Multimodal large models', '## Datasets']] |
| 44 | result = [ |
| 45 | '| Model ID | Model Type | Default Template | Default Agent Template | ' |
| 46 | 'Requires | Support Megatron | Tags | HF Model ID |\n' |
| 47 | '| -------- | -----------| ---------------- | ---------------------- | ' |
| 48 | '-------- | ---------------- | ---- | ----------- |\n' |
| 49 | ] * 2 |
| 50 | res_llm: List[Any] = [] |
| 51 | res_mllm: List[Any] = [] |
| 52 | mg_count_llm = 0 |
| 53 | mg_count_mllm = 0 |
| 54 | for template in TemplateType.get_template_name_list(): |
| 55 | assert template in TEMPLATE_MAPPING |
| 56 | |
| 57 | for model_type in ModelType.get_model_name_list(): |
| 58 | model_meta = MODEL_MAPPING[model_type] |
| 59 | for group in model_meta.model_groups: |
| 60 | for model in group.models: |
| 61 | ms_model_id = model.ms_model_id |
| 62 | hf_model_id = model.hf_model_id |
| 63 | if ms_model_id: |
| 64 | ms_model_id = f'[{ms_model_id}](https://modelscope.cn/models/{get_url_suffix(ms_model_id)})' |
| 65 | else: |
| 66 | ms_model_id = '-' |
| 67 | if hf_model_id: |
| 68 | hf_model_id = f'[{hf_model_id}](https://huggingface.co/{get_url_suffix(hf_model_id)})' |
| 69 | else: |
| 70 | hf_model_id = '-' |
| 71 | tags = ', '.join(group.tags or model_meta.tags) or '-' |
| 72 | requires = ', '.join(group.requires or model_meta.requires) or '-' |
| 73 | template = group.template or model_meta.template |
| 74 | template_meta = TEMPLATE_MAPPING.get(template) |
| 75 | agent_template = template_meta.agent_template if template_meta else '' |
| 76 | agent_template = agent_template or '' |
| 77 | if is_megatron_available(): |
| 78 | from mcore_bridge.model import MODEL_MAPPING as MCORE_MODEL_MAPPING |
| 79 | if supported_mcore_model_types is None: |
| 80 | supported_mcore_model_types = set( |
| 81 | list(chain.from_iterable([v.model_types for k, v in MCORE_MODEL_MAPPING.items()]))) |
| 82 | if model_meta.mcore_model_type is not None: |
| 83 | support_megatron = True |
| 84 | elif model_meta.model_type in supported_mcore_model_types: |
| 85 | support_megatron = True |
| 86 | else: |
| 87 | support_megatron = False |
| 88 | for word in ['gptq', 'awq', 'bnb', 'aqlm', 'int4', 'int8', 'nf4']: |
| 89 | if word in ms_model_id.lower(): |
| 90 | support_megatron = False |
| 91 | break |
| 92 | if support_megatron and 'fp8' in ms_model_id.lower() and not any( |
| 93 | word in ms_model_id.lower() for word in ['qwen', 'longcat', 'intern']): |
no test coverage detected