inference icon indicating copy to clipboard operation
inference copied to clipboard

QUESTION: CUDA out of memory when running baichuan-2-7b on 4090

Open chenmonster opened this issue 1 year ago • 7 comments

环境: torch==2.0.1+cu117 xinference==0.4.4 启动 baichuan-2-chat-7b 模型时,占用GPU内存大概13G,但是调用服务后,就显存溢出了,如下图: 1696756920025 1696756938235

chenmonster avatar Oct 08 '23 09:10 chenmonster

@chenmonster Hi,感谢对 xinference 的关注。

显存开销主要是由模型权重和 kv cache 两部分组成,kv cache 的大小和请求数量及生成文本长度正相关。

请问你在调用服务的时候,会有很大的负载吗?

UranusSeven avatar Oct 08 '23 10:10 UranusSeven

就是使用 flowise 调用 xinference API服务,知识库文件就 17k 大小,不应该有这么大的内存开销吧? 1696768790049

chenmonster avatar Oct 08 '23 12:10 chenmonster

首先,可以在 xinference 启动的时候,加上 --log-level debug,通过日志观察 flowise 具体发了哪些请求。

其次,从上图看,embedding 这一步也是在用 LLM 做,这个可能是导致 OOM 的关键。根据我们的经验,LLM 的 embedding 效果并不是很好,召回的文本与查询匹配度不是很高。因此推荐使用 xinference 内置的 embedding 模型来替代:https://inference.readthedocs.io/en/latest/models/builtin/index.html#embedding-models

UranusSeven avatar Oct 09 '23 08:10 UranusSeven

启动 embedding 模型 bge-large-zh 报错 image

chenmonster avatar Oct 11 '23 07:10 chenmonster

启动 embedding 模型 bge-large-zh 报错 image

好像是目前不支持在一张卡上同时启多个模型,不知道能否放宽限制,至少给同时启一个LLM和一个embedding @UranusSeven

Minamiyama avatar Nov 03 '23 03:11 Minamiyama

@Minamiyama @chenmonster 下周五的 release 中会支持。

UranusSeven avatar Nov 03 '23 05:11 UranusSeven

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] avatar Aug 09 '24 19:08 github-actions[bot]

This issue was closed because it has been inactive for 5 days since being marked as stale.

github-actions[bot] avatar Aug 15 '24 19:08 github-actions[bot]