THUDM / ChatGLM2-6B

ChatGLM2-6B: An Open Bilingual Chat LLM | 开源双语对话语言模型
Other
15.68k stars 1.85k forks source link

chatglm2-6b 本地部署api请求,显存越来越大 #546

Open kg-nlp opened 1 year ago

kg-nlp commented 1 year ago

Is there an existing issue for this?

Current Behavior

显存越来越大 image

Expected Behavior

No response

Steps To Reproduce

官方api示例 https://github.com/THUDM/ChatGLM2-6B/blob/main/api.py 切换成多卡加载

Environment

- OS:
- Python:3.9.12
- Transformers:4.31.0
- PyTorch:1.13.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :True

Anything else?

No response

wipen commented 1 year ago

Hi,我遇到了相似的问题,我这里的原因是history逐渐增多导致的。我这边在发送请求时将history的长度限定到20条以内就避免了爆显存。供参考。

Wisker566 commented 1 year ago

请问一下,如何限制对history的长度进行限定,第一次用不太会

kg-nlp commented 12 months ago

Hi,我遇到了相似的问题,我这里的原因是history逐渐增多导致的。我这边在发送请求时将history的长度限定到20条以内就避免了爆显存。供参考。

我这里每次访问history都会重置为[];有的时候会出现某次请求显存一直在增加,直到请求完之后,显存会恢复.

hxujal commented 11 months ago

Hi,我遇到了相似的问题,我这里的原因是history逐渐增多导致的。我这边在发送请求时将history的长度限定到20条以内就避免了爆显存。供参考。

请问如何限制history