ymcui / Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)
Apache License 2.0
7k stars 570 forks source link

访问次数多了以后显存不释放 #532

Closed godotg closed 3 months ago

godotg commented 4 months ago

提交前必须检查以下项目

问题类型

其他问题

基础模型

Chinese-Alpaca-2 (7B/13B)

操作系统

Linux

详细描述问题

image

刚开始启动只有大概17g显存的占用,访问了大概100次,显存就大概跑到23g了,其中有两次长时间没返回http主动断开连接继续进行下一次访问。使用api server的部署方式。

依赖情况(代码类问题务必提供)

No response

运行日志或截图

image

godotg commented 4 months ago

api server的日志输出没有任何报错

godotg commented 4 months ago

经过一晚上又降回了17显存

godotg commented 4 months ago

image

大概每50-100次就会遇到下面这个报错,torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 3.51 GiB (GPU 0; 23.65 GiB total capacity; 17.10 GiB already allocated; 2.61 GiB free; 20.28 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALL OC_CON

对于4090这样的显卡运行 Chinese-Alpaca-2 7B 这样的模型,显存占用是合理的吗?

iMountTai commented 4 months ago

模型本身权重就有14G左右,17G显存占用是合理的。运行中显存占用升高应该是每次推理缓存没有清理的原因,可以试试每次推理完将之前的记录等都清理了。脚本本身是指导性的作用,不一定那么完善,欢迎修改完善。

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your consideration.

github-actions[bot] commented 3 months ago

Closing the issue, since no updates observed. Feel free to re-open if you need any further assistance.