执行样例前请使用以下命令配置环境变量。
source /usr/local/Ascend/ascend-toolkit/set_env.sh # CANN
source /usr/local/Ascend/nnal/atb/set_env.sh # ATB
source /usr/local/Ascend/llm_model/set_env.sh # ATB Models
source /usr/local/Ascend/mindie/set_env.sh # MindIE
SMPL_PARAM='{"temperature":0.5,"top_k":10,"top_p":0.9,"seed":1234,"repetition_penalty":1}' benchmark \ --DatasetPath "/{数据集路径}/GSM8K" \ --DatasetType "gsm8k" \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Concurrency 128 \ --TaskKind stream \ --Tokenizer True \ --MaxOutputLen 512 \ --DoSampling True \ --SamplingParams $SMPL_PARAM
Client模式下仅当TaskKind=stream_token时,--Tokenizer为False。
通过--TaskKind参数区分不同Client推理模式。
benchmark \ --DatasetPath "/{数据集路径}/GSM8K" \ --DatasetType "gsm8k" \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Concurrency 128 \ --TaskKind text \ --Tokenizer True \ --MaxOutputLen 512
benchmark \ --DatasetPath "/{数据集路径}/GSM8K" \ --DatasetType "gsm8k" \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Concurrency 128 \ --TaskKind stream \ --Tokenizer True \ --MaxOutputLen 512
在使用合成数据(synthetic)进行性能测试时,不需要指定 --DatasetPath,需要指定--DatasetType 为"synthetic"。另外需要指定配置文件--SyntheticConfigPath,文件配置内容见7.3 配置MindIE Benchmark。其他参数和其他性能测试保持一致。
benchmark \ --DatasetType "synthetic" \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType vllm_client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Concurrency 128 \ --MaxOutputLen 20 \ --TaskKind stream \ --Tokenizer True \ --SyntheticConfigPath /{配置文件路径}/synthetic_config.json
export LCCL_DETERMINISTIC=1 export HCCL_DETERMINISTIC=true export ATB_MATMUL_SHUFFLE_K_ENABLE=0
benchmark \ --DatasetPath "/{数据集路径}/MMLU" \ --DatasetType mmlu \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Concurrency 1 \ --MaxOutputLen 20 \ --TaskKind stream \ --Tokenizer True \ --TestAccuracy True
在以下场景中,需要设置惩罚系数(如:repetition_penalty)而不需要设置采样参数(如:top_k),通过--DoSampling参数设定为False和--SamplingParams参数设置参数值实现。
benchmark \ --DatasetPath "/{数据集路径}/GSM8K/" \ --DatasetType gsm8k \ --ModelName llama_7b \ --ModelPath "/{模型权重路径}/llama_7b" \ --TestType client \ --Http https://{ipAddress}:{port} \ --ManagementHttp https://{managementIpAddress}:{managementPort} \ --Tokenizer True \ --TestAccuracy True \ --DoSampling False \ --SamplingParams '{"repetition_penalty": 1.03}'