Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
InternLM_vllm
Commits
ceccb716
"torchvision/vscode:/vscode.git/clone" did not exist on "2937d77d676c604dc071ddf9cf8d8fcd66cc1736"
Commit
ceccb716
authored
Oct 11, 2025
by
laibao
Browse files
vllm0.9.2 更新README.md,修改Docker镜像版本和vllm依赖库信息,简化推理命令示例。
parent
40b3cdf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
README.md
README.md
+14
-13
No files found.
README.md
View file @
ceccb716
...
...
@@ -4,11 +4,11 @@
`InternLM2 Technical Report`
-
[https://arxiv.org/pdf/2403.17297
]
-
[
InternLM2 Technical Report
](
https://arxiv.org/pdf/2403.17297
)
## 模型结构
Intern
lm
2.5与Intern
lm
2模型结构相同,但取得更好效果,Intern
lm
2采用L
L
ama和GQA结构,相较于Intern
lm
改进了Wqkv的权重矩阵进行交错重排,不再简单堆叠每个头的Wk、Wq和Wv矩阵。此交织重排操作大概能提高5%的训练效率。
Intern
LM
2.5与Intern
LM
2模型结构相同,但取得更好效果,Intern
LM
2采用L
l
ama和GQA结构,相较于Intern
LM
改进了Wqkv的权重矩阵进行交错重排,不再简单堆叠每个头的Wk、Wq和Wv矩阵。此交织重排操作大概能提高5%的训练效率。
<div
align=
center
>
<img
src=
"doc/struct.png"
/>
...
...
@@ -16,7 +16,7 @@ Internlm2.5与Internlm2模型结构相同,但取得更好效果,Internlm2采
## 算法原理
Intern
lm
2.5主要是更新了7B系列的Chat模型。其中InternLM2.5-7B-Chat-1M模型支持百万长度的上下文窗口。主要核心点有三个:(1)卓越的模型推理能力,在数学推理的任务上达到了SOTA,超过了同等规模参数量的其他模型,如L
LaMA
3-8B和Gemma-9B;(2)支持百万长度上下文长度的推理,并且可以通过LMDeploy快速部署,开箱即用;(3)增加了更多的应用工具的支持
Intern
LM
2.5主要是更新了7B系列的Chat模型。其中InternLM2.5-7B-Chat-1M模型支持百万长度的上下文窗口。主要核心点有三个:(1)卓越的模型推理能力,在数学推理的任务上达到了SOTA,超过了同等规模参数量的其他模型,如L
lama
3-8B和Gemma-9B;(2)支持百万长度上下文长度的推理,并且可以通过LMDeploy快速部署,开箱即用;(3)增加了更多的应用工具的支持
<div
align=
center
>
<img
src=
"doc/eval1.png"
/>
...
...
@@ -32,7 +32,7 @@ Internlm2.5主要是更新了7B系列的Chat模型。其中InternLM2.5-7B-Chat-1
提供
[
光源
](
https://www.sourcefind.cn/#/image/dcu/custom
)
拉取推理的docker镜像:
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:vllm0.
8.5
-ubuntu22.04-dtk25.04.1-rc5-das1.6-py3.10-20250
724
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:vllm0.
9.2
-ubuntu22.04-dtk25.04.1-rc5-
rocblas104381-0915-
das1.6-py3.10-20250
916-rc2
# <Image ID>用上面拉取docker镜像的ID替换
# <Host Path>主机端路径
# <Container Path>容器映射路径
...
...
@@ -65,7 +65,7 @@ conda create -n internlm_vllm python=3.10
*
lmslim: 0.2.1
*
flash_attn: 2.6.1
*
flash_mla: 1.0.0
*
vllm: 0.
8.5
*
vllm: 0.
9.2
*
python: python3.10
`Tips:需先安装相关依赖,最后安装vllm包`
...
...
@@ -96,7 +96,7 @@ export VLLM_RANK7_NUMA=7
### 离线批量推理
```
bash
VLLM_USE_FLASH_ATTN_PA
=
1
python examples/offline_inference/basic/basic.py
python examples/offline_inference/basic/basic.py
```
其中,
`prompts`
为提示词;
`temperature`
为控制采样随机性的值,值越小模型生成越确定,值变高模型生成更随机,0表示贪婪采样,默认为1;
`max_tokens=16`
为生成长度,默认为1;
...
...
@@ -107,7 +107,7 @@ VLLM_USE_FLASH_ATTN_PA=1 python examples/offline_inference/basic/basic.py
1、指定输入输出
```
bash
VLLM_USE_FLASH_ATTN_PA
=
1
python benchmarks/benchmark_throughput.py
--num-prompts
1
--input-len
32
--output-len
128
--model
internlm/internlm2_5-7b
-tp
1
--trust-remote-code
--enforce-eager
--dtype
float16
python benchmarks/benchmark_throughput.py
--num-prompts
1
--input-len
32
--output-len
128
--model
internlm/internlm2_5-7b
-tp
1
--trust-remote-code
--enforce-eager
--dtype
float16
```
其中
`--num-prompts`
是batch数,
`--input-len`
是输入seqlen,
`--output-len`
是输出token长度,
`--model`
为模型路径,
`-tp`
为使用卡数,
`dtype="float16"`
为推理数据类型,如果模型权重是bfloat16,需要修改为float16推理。若指定
`--output-len 1`
即为首字延迟。
`-q gptq`
为使用gptq量化模型进行推理。如果提示上下文受限,可以添加--max-model-len 64000
...
...
@@ -117,7 +117,7 @@ VLLM_USE_FLASH_ATTN_PA=1 python benchmarks/benchmark_throughput.py --num-prompts
[
sharegpt_v3_unfiltered_cleaned_split
](
https://huggingface.co/datasets/learnanything/sharegpt_v3_unfiltered_cleaned_split
)
```
bash
VLLM_USE_FLASH_ATTN_PA
=
1
python benchmarks/benchmark_throughput.py
--num-prompts
1
--model
internlm/internlm2_5-7b
--dataset-name
sharegpt
--dataset-path
/path/to/ShareGPT_V3_unfiltered_cleaned_split.json
-tp
1
--trust-remote-code
--enforce-eager
--dtype
float16
python benchmarks/benchmark_throughput.py
--num-prompts
1
--model
internlm/internlm2_5-7b
--dataset-name
sharegpt
--dataset-path
/path/to/ShareGPT_V3_unfiltered_cleaned_split.json
-tp
1
--trust-remote-code
--enforce-eager
--dtype
float16
```
其中
`--num-prompts`
是batch数,
`--model`
为模型路径,
`--dataset`
为使用的数据集,
`-tp`
为使用卡数,
`dtype="float16"`
为推理数据类型,如果模型权重是bfloat16,需要修改为float16推理。
`-q gptq`
为使用gptq量化模型进行推理。
...
...
@@ -127,7 +127,7 @@ VLLM_USE_FLASH_ATTN_PA=1 python benchmarks/benchmark_throughput.py --num-prompts
1.
启动服务:
```
bash
VLLM_USE_FLASH_ATTN_PA
=
1
vllm serve
--model
internlm/internlm2_5-7b
--enforce-eager
--dtype
float16
--trust-remote-code
--tensor-parallel-size
1
vllm serve
--model
internlm/internlm2_5-7b
--enforce-eager
--dtype
float16
--trust-remote-code
--tensor-parallel-size
1
```
2.
启动客户端
...
...
@@ -136,17 +136,18 @@ VLLM_USE_FLASH_ATTN_PA=1 vllm serve --model internlm/internlm2_5-7b --enforce-ea
python benchmarks/benchmark_serving.py --model internlm/internlm2_5-7b --dataset-name sharegpt --dataset-path /path/to/ShareGPT_V3_unfiltered_cleaned_split.json --num-prompts 1 --trust-remote-code
```
参数同使用数据集,离线批量推理性能测试,具体参考
[
benchmarks/benchmark_serving.py
](
/codes/modelzoo/qwen1.5_vllm/-/blob/master/benchmarks/benchmark_serving.py
)
参数同使用数据集,离线批量推理性能测试,具体参考[benchmarks/benchmark_serving.py]
(benchmarks/benchmark_serving.py)
### OpenAI兼容服务
启动服务:
```
bash
VLLM_USE_FLASH_ATTN_PA
=
1
vllm serve internlm/internlm2_5-7b
--enforce-eager
--dtype
float16
--trust-remote-code
vllm serve internlm/internlm2_5-7b
--enforce-eager
--dtype
float16
--trust-remote-code
```
这里 serve之后为加载模型路径,
`--dtype`
为数据类型:float16,默认情况使用tokenizer中的预定义聊天模板,
`--chat-template`
可以添加新模板覆盖默认模板,
`-q gptq`
为使用gptq量化模型进行推理,
`-q awq
q
`
为使用awq量化模型进行推理。
这里 serve之后为加载模型路径,
`--dtype`
为数据类型:float16,默认情况使用tokenizer中的预定义聊天模板,
`--chat-template`
可以添加新模板覆盖默认模板,
`-q gptq`
为使用gptq量化模型进行推理,
`-q awq`
为使用awq量化模型进行推理。
列出模型型号:
...
...
@@ -222,7 +223,7 @@ ssh -L 8000:计算节点IP:8000 -L 8001:计算节点IP:8001 用户名@登录节
3.
启动OpenAI兼容服务
```
VLLM_USE_FLASH_ATTN_PA=1
vllm serve internlm/internlm2_5-7b --enforce-eager --dtype float16 --trust-remote-code --host "0.0.0.0"
vllm serve internlm/internlm2_5-7b --enforce-eager --dtype float16 --trust-remote-code --host "0.0.0.0"
```
如果提示上下文受限,可以添加--max-model-len 64000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment