AI软件下载
有趣网站推荐及实用软件下载

triton.runtime.errors.OutOfResources: out of resource: shared memory, Required: 126978, Hardware limit: 101376. Reducing block sizes or `num_stages` may help

今天在调试python应用MonkeyOCR的时候发生报错,部分错误信息如下:

File “D:\python\MonkeyOCR\py310\lib\site-packages\lmdeploy\pytorch\nn\attention.py”, line 154, in forward return self.impl.forward( File “D:\python\MonkeyOCR\py310\lib\site-packages\lmdeploy\pytorch\backends\cuda\flash_attention.py”, line 56, in forward self.flash_attention_fwd( File “D:\python\MonkeyOCR\py310\lib\site-packages\lmdeploy\pytorch\kernels\cuda\flashattention.py”, line 449, in flash_attention_fwd _flash_prefill_fwd_kernel[grid]( File “D:\python\MonkeyOCR\py310\lib\site-packages\triton\runtime\jit.py”, line 345, in <lambda> return lambda *args, **kwargs: self.run(grid=grid, warmup=False, *args, **kwargs) File “D:\python\MonkeyOCR\py310\lib\site-packages\triton\runtime\jit.py”, line 691, in run kernel.run(grid_0, grid_1, grid_2, stream, kernel.function, kernel.packed_metadata, launch_metadata, File “D:\python\MonkeyOCR\py310\lib\site-packages\triton\compiler\compiler.py”, line 385, in __getattribute__ self._init_handles() File “D:\python\MonkeyOCR\py310\lib\site-packages\triton\compiler\compiler.py”, line 378, in _init_handles raise OutOfResources(self.metadata.shared, max_shared, “shared memory”) triton.runtime.errors.OutOfResources: out of resource: shared memory, Required: 126978, Hardware limit: 101376. Reducing block sizes or `num_stages` may help. 2025-07-01 12:43:43,759 – lmdeploy – ERROR – async_engine.py:791 – session 0 finished, reason “error”

主要错误就是:

triton.runtime.errors.OutOfResources: out of resource: shared memory, Required: 126978, Hardware limit: 101376. Reducing block sizes or `num_stages` may help.

意思就是共享内存资源不足,也就是共享显存不足

报错信息也给出了解决方法:

Reducing block sizes or `num_stages` may help

找到flashattention.py文件位置,我这里是:

\lib\site-packages\lmdeploy\pytorch\kernels\cuda\flashattention.py

找到num_stages值,

原代码是根据条件动态赋值的:

num_stages=num_stages,

我这里直接给设置了个小一点的固定值:

#num_stages=num_stages,
num_stages=2,

作为临时解决方案

重新运行程序不再发生报错。

AI应用在线一键启动,低价爽玩4090:立即体验>>

软件催更及1对1人工答疑支持: https://nuowa.net/1806
赞(0) 打赏
软件无法使用?点击查看常见问题说明>>

最近更新

comfyui视频人物换主体工作流及模型下载-诺瓦小站

comfyui视频人物换主体工作流及模型下载

本次分享一个好玩的视频人物换主体工作流,本工作流可以使用一张图片中的主体替换视频中的人物主体。比如抖音上很多热门的猴子炒饭,奥特曼炒饭,猴子vlog等等,都可以使用人物主体替换把原来视频中的人物替换成指定的人物。 comfyui工作流节点使...

凡人修仙传动画韩立高清图片壁纸素材AI绘画图集-诺瓦小站

凡人修仙传动画韩立高清图片壁纸素材AI绘画图集

恭迎韩天尊! 祝贺韩天尊顺利结婴! 热门国漫凡人修仙传动画已经更新了5年了,最新一集,主人公韩立顺利结婴,成为一名元婴修士。我属于是比较喜欢看动漫的,看过的动漫估计没过百也得大几十了,热门国漫大多都看过。凡人修仙传算是最喜欢的动漫之一,韩立...

觉得文章对你有帮助就打赏一下作者

非常感谢你的打赏,我将有更多的动力继续提供优质内容,让我们一起创建更加美好的世界!

支付宝扫一扫

微信扫一扫