ymcui/Chinese-LLaMA-Alpaca-2

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

jaysunxiao opened this issue · 6 comments

提交前必须检查以下项目

  • 请确保使用的是仓库最新代码(git pull),一些问题已被解决和修复。
  • 我已阅读项目文档FAQ章节并且已在Issue中对问题进行了搜索,没有找到相似问题和解决方案。
  • 第三方插件问题:例如llama.cppLangChaintext-generation-webui等,同时建议到对应的项目中查找解决方案。

问题类型

其他问题

基础模型

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

操作系统

Linux

详细描述问题

image

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

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

No response

运行日志或截图

image

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

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

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 这样的模型,显存占用是合理的吗?

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

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.

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