文件最后提交记录最后更新时间
10 个月前
9 个月前
10 个月前
10 个月前
9 个月前
10 个月前
8 个月前
11 个月前
7 个月前
10 个月前
1 年前
1 年前
README

MindSpeed-LLM 测试用例贡献说明

所有测试用例仅支持Megatron-Mcore模型结构。

门禁看护列表

Tests Module Features Scripts Acc. Throu. Mem.
ST Pretrain TP,PP,VPP,distributed_optimizer,o2_gradient,o2_optimizer,重计算,enable_recompute_layers_per_pp_rank,FA_TND,use_fused_rotary_pos_emb llama2_tp2_pp4_vpp2_ptd.sh Y Y Y
TP2D, TP, PP, VPP, distributed_optimizer, fused_swiglu llama2_tp4pp2vpp2_tp2d_tpx2tpy2.sh Y Y Y
cp_ring,分布式优化器,reuse_fp32_param,recompute_activation_function,fused_rmsnorm,fused_swiglu,fused_rope,overlap_grad_reduce, overlap_param_gather llama2_tp2_cp4_mem_recompute.sh Y Y Y
moe_alltoall_overlap_comm,moe-zero-memory,swap-attention,reuse_fp32_param,fused_rmsnorm,fused_swiglu deepseek_500b_tp1_pp2_ep2_cp2_overlap.sh Y Y Y
cp_ring,general_cp,double_ring,分布式优化器,reuse_fp32_param,recompute_activation_function,fused_rmsnorm,fused_swiglu,fused_rope,overlap_grad_reduce, overlap_param_gather llama2_tp2_cp4_general_double_ring.sh Y Y Y
n_group,seq_aux,gradient_accumulation_fusion,recompute_mtp_layer,recompute_mtp_norm deepseek_v3_mcore_tp1_pp2_ep4.sh Y Y Y
pp2vpp,recompute_in_advance,matmul_add llama3_tp2_pp2_vpp1.sh Y Y Y
cp_hybrid,gqa chatglm3_gqa_cp8.sh Y Y Y
swap_attention,recompute_activation_function,enable_recompute_layers_per_pp_rank,reuse_fp32_param llama2_tp2_pp4_vpp2_swap.sh Y Y Y
EP,CP,num_experts,moe_router_topk,aux_loss,moe_allgather,group_query_attention,rotary_base mixtral_mcore_tp4_cp2_ep2_ptd.sh Y Y Y
mla_attention,moe_grouped_gemm,EP,allgather_dispatcher,moe_allgather_overlap_comm,use_fused_rotary_pos_emb,recompute_norm deepseek_v2_mcore_tp1_pp1_ep8.sh Y Y Y
MOE,PP,EP,Drop,DPP mixtral_tp1_pp4_ep2_drop_dpp.sh Y Y Y
shared_experts shared_expert_gate qwen2_moe_tp1_pp2_ep2_cp2_32k_ptd.sh Y Y Y
noop_layers, recompute_norm llama3_mcore_tp2_pp2_vpp2_noop_layer.sh Y Y Y
LoRA CCLoRA, QLoRA tune_llama2_tp1_pp1_qlora_ptd.sh Y Y Y
UT Inference greedy_search, lora_inference, deterministic_computation test_inference.py Y
Evaluation mmlu, prompt_mmlu, qwen2_mmlu, agieval, bbh test_evaluate.py Y
Checkpoint hf2mcore, mcore2hf, TP, PP, EP, DPP, VPP, moe, noop_layers, lora, ORM test_checkpoint.py Y
deepseek2, deepseek2_lite, llama2, llama3, qwen2 Y
ProcessData pretrain_data_alpaca, pretrain_merge_datasets, instruction_data_alpaca, instruction_merge_datasets test_preprocess_data.py Y

Pipeline 二级流水看护列表

Model Module Test Case Accuracy Throughput Memory
CP hybrid test_hybrid_context_parallel.py Y
ring_attn test_ringattn_context_parallel.py Y
ulysses test_ulysses_context_parallel.py Y
ModelModule rope test_rotary_pos_embedding.py Y
moe test_topk_router.py Y
transformer_attention, alibi test_attention.py Y
Checkpoint hf2mcore, mcore2hf, TP, PP, EP, DPP, VPP, moe, noop_layers, lora test_checkpoint.py Y
mixtral, deepseek2, deepseek2_lite, gemma2, llama3, qwen2, llama2 Y
Inference greedy_search, deterministic_computation, chatglm3_inference, baichuan2_inference test_inference.py Y
Evaluation humaneval test_evaluate.py Y
ProcessData instruction_data_alpaca, instruction_data_alpaca_history, instruction_data_sharegpt, instruction_data_openai, test_process_instruction_data_lf.py Y
instruction_data_handler test_process_instruction_pack_data.py Y
pairwise_data_alpaca, pairwise_data_sharegpt test_process_pairwise_data_lf.py Y
Baichuan2-13B data_process test_process_pretrain_data.py Y
pretrain baichuan2_13b_tp8_pp1_mcore.sh Y Y Y
Chatglm3-6B data_process test_process_pretrain_data.py Y
pretrain chatglm3_tp1_pp2_rope.sh Y Y Y
Bloom-7B data_process test_process_pretrain_data.py Y
Gemma-7B data_process test_process_pretrain_data.py Y
pretrain gemma2_tp8_pp1_ptd.sh Y Y Y
Glm4 no-bias-swiglu-fusion glm4_9b_8k_tp2_pp2_ptd.sh Y Y Y
Grok1 embedding-multiplier-scale, output-multiplier-scale, input-jitter grok1_40b_tp4_ep2_ptd.sh Y Y Y
Hunyuan cla-share-factor, cut-max-seqlen, share-kvstates, pad-to-multiple-of, moe-revert-type-after-topk, scale-depth tune_hunyuanLarge_389b_tp1_pp1_ep8_ptd.sh Y Y Y
Interlm3 skip-bias-add, dynamic-factor, distributed-timeout-minutes, exit-on-missing-checkpoint internlm3_8b_tp1_pp4_cp2_ptd.sh Y Y Y
Qwen15-7B data_process test_process_pretrain_data.py Y
evaluation test_evaluation.py Y
Qwen25 sparse-mode, padded-samples tune_qwen25_0point5b_tp1_pp1_pack.sh Y Y Y
GPT4 pretrain gpt4_mcore_tp4_cp2_32k_moe_drop.sh Y Y Y
Deepseek pretrain deepseek2_tp1_pp1_mcore_moe.sh Y Y Y
Deepseek_lite convert_ckpt test_deepseek_lite_ckpt_optim.py Y
Mixtral pretrain mixtral_tp1_pp4_ep2_drop_mcore.sh Y Y Y
LoRA tune_mixtral_tp2_pp2_lora_ptd.sh Y Y Y
Llama2 LoRA tune_llama2_tp1_pp1_lora_ptd.sh Y Y Y
FullSFT tune_llama2_tp2_pp4_vpp2_mcore_full.sh Y Y Y
pretrain llama2_tp8_pp1_coc_ptd.sh Y Y Y
convert_ckpt test_llama2_7b_ckpt_optim.py Y
pretrain llama2_tp1_pp8_patch_gloo_ptd.sh Y Y Y
Minicpm dim-model-base, scale-emb minicpm_2b_tp1_pp1.sh Y Y Y
Phi-3.5-MoE-instruct pretrain phi35_moe_tp1_pp8_mcore.sh Y Y Y
data_process test_process_pretrain_data.py Y
ckpt_hf2mg test_ckpt_hf2mg.py Y
inference test_generation.py Y
evaluation test_evaluation.py Y

DT覆盖率看护

在NPU机器运行 run_coverage.sh 脚本,运行目录将生成 htmlcov 文件夹,将该文件夹复制到本地电脑,在浏览器中打开 htmlcov/index.html 文件,可以看到覆盖率信息。

脚本中 branch 的值改为 True ,可以测试分支覆盖率。

开发规则

ST

① 贡献脚本用例请放置于 st/shell_scripts 文件夹下,命名规则为 {模型名}_{切分策略} 或者 {模型名}_{特性名称}, 如 llama2_tp2_pp4_vpp2_ptd.sh,请贡献者严格对齐;

② 注意脚本用例中不需要单独重定向log,日志收集工作已在 st_run.sh 中统一管理;

③ 标杆数据请放置于 st/baseline_results 文件夹下,命名保证完全与 shell 脚本对齐,否则自动化脚本执行将扫描不到;

④ 获取标杆数据:通过门禁任务执行获得首次数据,并将结果保存至本地 log 或者 txt 文件中,后通过本地执行 st/st_utils/common.py 中的 transfer_logs_as_json 函数进行提取,最后再连同用例脚本上仓即可;

⑤ 在贡献时候需要考虑最终校验的具体指标,精度(Acc.)、性能(Throu.)、显存(Mem.),在对应指标空白处填上 Y,如无校验的保留空白即可。

UT

① 建议所有 UT 用例通过分布式 pytest 来拉起,即继承 tests/common.py 文件下的 DistributedTest,指定 world_size,具体参照已有用例即可;

② 建议按照功能特性进行文件夹命名区分,至多不超过两层目录,所有用例以 test 作为命名前缀;

③ 新增用例可以在原有用例基础上做 test_xxx 的补充,尽量保证测试功能的集成性;对于存在 .json 文件的用例,贡献时在 .json 中加入 test_xxx 配置,然后在 .py 中通过 @pytest.mark.parametrize 传入参数、构造用例,请注意 .json 中的 key 值命名需与 .py 中的 test_xxx 保持统一;

④ 在贡献时候需要考虑最终校验的具体指标,精度(Acc.)、性能(Throu.)、显存(Mem.),在对应指标空白处填上 Y,如无校验的保留空白即可。

Pipeline

①贡献脚本用例放置于pipeline/的对应模型文件夹下,如baichuan2-13B,文件命名规则为 {模型名}{切分策略} 或者 {模型名}{特性名称}, 如 baichuan2_13B_tp8_pp1_ptd.sh,请贡献者严格对齐;

② 注意脚本用例中不需要单独重定向log,日志收集工作已在 pipe_run.sh 中进行统一管理;

③ 标杆数据请放置于 pipeline/baseline 文件夹下,命名保证完全与 shell 脚本对齐,否则自动化脚本执行将扫描不到;

④ 获取标杆数据:通过门禁任务执行获得首次数据,并将结果保存至本地 log 或者 txt 文件中,后通过本地执行 tests/st/st_utils/common.py 中的 transfer_logs_as_json 函数进行提取,最后再连同用例脚本上仓即可;

⑤ 在贡献时候需要考虑最终校验的具体指标,精度(Acc.)、性能(Throu.)、显存(Mem.),在对应指标空白处填上 Y,如无校验的保留空白即可。