xusenlinzy / api-for-open-llm

Openai style api for open large language models, using LLMs just as chatgpt! Support for LLaMA, LLaMA-2, BLOOM, Falcon, Baichuan, Qwen, Xverse, SqlCoder, CodeLLaMA, ChatGLM, ChatGLM2, ChatGLM3 etc. 开源大模型的统一后端接口
Apache License 2.0
2.16k stars 252 forks source link

使用api-for-open-llm&vllm多卡部署运行Qwen2-7B时报错显存占满 #290

Open Woiea opened 1 week ago

Woiea commented 1 week ago

提交前必须检查以下项目 | The following items must be checked before submission

问题类型 | Type of problem

模型推理和部署 | Model inference and deployment

操作系统 | Operating system

Linux

详细描述问题 | Detailed description of the problem

复制.env.vll.example文件并改名成为.env。
.env文件关键部分如下:
# api related
API_PREFIX=/v1
MAX_SEQ_LEN_TO_CAPTURE=4096
# vllm related
ENGINE=vllm
TRUST_REMOTE_CODE=true
TOKENIZE_MODE=auto
TENSOR_PARALLEL_SIZE=2
NUM_GPUs = 2
GPU_MEMORY_UTILIZATION=0.95
DTYPE=auto

执行指令python api/server.py

运行时报错GPU内存溢出或者模型长度过长,提示扩大GPU_MEMORY_UTILIZATION或者减小max_model_len。 另外采取docker部署时遇到了多进程处理错误。

Dependencies

# 请在此处粘贴依赖情况
# Please paste the dependencies here

运行日志或截图 | Runtime logs or screenshots

# 请在此处粘贴运行日志
# Please paste the run log here

api-for-open-llm部署时报错: image

docker部署时报错: image

Woiea commented 1 week ago

在.env文件加入下面参数可以排除这个内存溢出错误: CONTEXT_LEN=100000 该参数取值小于最大允许取值即可(115648)

xusenlinzy commented 1 week ago

多进程处理错误可以试试加上 DISTRIBUTED_EXECUTOR_BACKEND=ray

Woiea commented 1 week ago

多进程处理错误可以试试加上 DISTRIBUTED_EXECUTOR_BACKEND=ray

加上这个参数后,仍然报下面错: image 而且之前报这个错后程序卡停,添加DISTRIBUTED_EXECUTOR_BACKEND=ray这个参数后程序报错自动拉起,报错后重新启动

xusenlinzy commented 6 days ago

我之前也遇到过这个错误,你的代码是最新的吗,在环境变量里面加上 image 就没有出现上面的问题了

Woiea commented 6 days ago

我之前也遇到过这个错误,你的代码是最新的吗,在环境变量里面加上 image 就没有出现上面的问题了

谢谢!方法有效!目前问题已解决