5.3. llama

llama2-70b-w8a8c8

本模型推理及性能测试需要4张enflame gcu。

模型下载

  • 如需要下载权重,请联系商务人员开通EGC权限进行下载

  • 下载llama2-70b-w8a8.tar文件并解压,将压缩包内的内容全部拷贝到llama2-70b-w8a8文件夹中。

  • int8_kv_cache.json文件请联系商务人员开通EGC权限进行下载,并拷贝到llama2-70b-w8a8文件夹中。

  • llama2-70b-w8a8目录结构如下所示:

llama2-70b-w8a8/
├── int8_kv_cache.json
├── tops_quantize_info.json
├── config.json
├── generation_config.json
├── model.safetensors
├── quantize_config.json
├── special_tokens_map.json
├── tokenizer_config.json
├── tokenizer.json
└── tokenizer.model

批量离线推理

python3 -m vllm_utils.benchmark_test \
 --model=[path of llama2-70b-w8a8] \
 --quantization-param-path [path of int8_kv_cache.json] \
 --tensor-parallel-size 4 \
 --max-model-len=2048 \
 --demo=te \
 --dtype=float16 \
 --output-len=128 \
 --device gcu \
 --kv-cache-dtype int8 \
 --gpu-memory-utilization 0.9

性能测试

python3 -m vllm_utils.benchmark_test --perf \
 --model=[path of llama2-70b-w8a8] \
 --quantization-param-path [path of int8_kv_cache.json] \
 --tensor-parallel-size 4 \
 --max-model-len=2048 \
 --input-len=1024 \
 --output-len=1024 \
 --num-prompts=1 \
 --block-size=64 \
 --dtype=float16 \
 --kv-cache-dtype int8 \
 --device gcu \
 --gpu-memory-utilization 0.9

注:

  • 本模型支持的max-model-len为4096;

  • input-lenoutput-lennum-prompts可按需调整;

  • 配置 output-len为1时,输出内容中的latency即为time_to_first_token_latency;

Meta-Llama-3.1-70B-Instruct_W8A8C8

本模型推理及性能测试需要4张enflame gcu。

模型下载

  • 如需要下载权重,请联系商务人员开通EGC权限进行下载

  • 下载Meta-Llama-3.1-70B-Instruct_W8A8.tar文件并解压,将压缩包内的内容全部拷贝到Meta-Llama-3.1-70B-Instruct_W8A8文件夹中。

  • int8_kv_cache.json文件请联系商务人员开通EGC权限进行下载,并拷贝到Meta-Llama-3.1-70B-Instruct_W8A8文件夹中。

  • Meta-Llama-3.1-70B-Instruct_W8A8目录结构如下所示:

Meta-Llama-3.1-70B-Instruct_W8A8
├── config.json
├── int8_kv_cache.json
├── model.safetensors
├── quantize_config.json
├── tokenizer_config.json
├── tokenizer.json
└── tops_quantize_info.json

批量离线推理

python3 -m vllm_utils.benchmark_test \
 --demo=te \
 --model=[path of Meta-Llama-3.1-70B-Instruct_W8A8] \
 --quantization-param-path [path of int8_kv_cache.json] \
 --kv-cache-dtype int8 \
 --quantization=w8a8 \
 --max-model-len=2048 \
 --tensor-parallel-size 4 \
 --dtype=float16 \
 --output-len=128 \
 --device gcu \
 --gpu-memory-utilization 0.9

性能测试

python3 -m vllm_utils.benchmark_test --perf \
 --model=[path of Meta-Llama-3.1-70B-Instruct_W8A8] \
 --quantization-param-path [path of int8_kv_cache.json] \
 --kv-cache-dtype int8 \
 --tensor-parallel-size 4 \
 --max-model-len=2048 \
 --input-len=512 \
 --output-len=128 \
 --num-prompts=1 \
 --block-size=64 \
 --dtype=float16 \
 --device gcu \
 --gpu-memory-utilization 0.9

注:

  • 本模型支持的max-model-len为4096;

  • input-lenoutput-lennum-prompts可按需调整;

  • 配置 output-len为1时,输出内容中的latency即为time_to_first_token_latency;

llama2-70b-w4a16c8

本模型推理及性能测试需要4张enflame gcu。

模型下载

  • 如需要下载权重,请联系商务人员开通EGC权限进行下载

  • 下载llama2_70b_w4a16c8.tar文件以及并解压,将压缩包内的内容全部拷贝到llama2_70b_w4a16c8.tar文件夹中。

  • llama2_70b_w4a16c8.tar目录结构如下所示:

.
├── config.json
├── int8_kv_cache.json
├── model.safetensors
├── quantize_config.json
├── special_tokens_map.json
├── tokenizer_config.json
├── tokenizer.json
├── tokenizer.model
└── tops_quantize_info.json

批量离线推理

python3 -m vllm_utils.benchmark_test \
    --demo='te' \
    --model=[path of llama2-70b-w4a16c8] \
    --tokenizer=[path of llama2-70b-w4a16c8] \
    --output-len=128 \
    --device=gcu \
    --dtype=float16 \
    --quantization=gptq \
    --quantization-param-path=[path of int8_kv_cache.json] \
    --kv-cache-dtype=int8 \
    --tensor-parallel-size 4

性能测试

python3 -m vllm_utils.benchmark_test \
    --perf \
    --model=[path of llama2-70b-w4a16c8] \
    --tensor-parallel-size 4 \
    --max-model-len=4096 \
    --input-len=1024 \
    --output-len=1024 \
    --dtype=float16 \
    --device gcu \
    --num-prompts 1 \
    --block-size=64 \
    --quantization=gptq \
    --quantization-param-path=[path of int8_kv_cache.json] \
    --kv-cache-dtype=int8 \
    --trust-remote-code

注:

  • 本模型支持的max-model-len为4096;

  • input-lenoutput-lennum-prompts可按需调整;

  • 配置 output-len为1时,输出内容中的latency即为time_to_first_token_latency;