-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用python predict_i2v.py后OOM #2
Comments
能问下生成多大的分辨率吗,感觉 Tried to allocate 109.01 GiB 有点太大了。 仓库中的 predict_i2v.py 应该 24 GiB 显存可以运行的。 |
我没有改任何的内容,直接下载好模型后,就调用predict_i2v.py去生成,这个应该是使用的默认的吧? |
是的,predict_i2v.py 是默认的设置。 挺奇怪的,通常每次只会申请 500 MiB ~ 1.2 GiB 左右,想象不到哪边会申请 109 GiB。 能发送一下运行环境等信息吗?可能是 PyTorch 版本的问题,我这边用 2.5.1 可以运行的。 |
这是完整的报错: python predict_i2v.pyVae loaded ... |
感谢提供的信息,运行环境上除了 CUDA 版本外基本是相同的,报错信息中显示 PyTorch 的 scaled_dot_product_attention 出现了问题,推测是 scaled_dot_product_attention 的某些加速机制与 CUDA 或 显卡版本不兼容导致的。 试试关闭加速后能否运行呢,调用这些方法能关闭加速: torch.backends.cuda.enable_flash_sdp(False) 可以每次关闭一种,看看哪种能够跑通。 |
目前结果是,前两个没有用,还是报OOM 最后一个报其他的错误 当三个都同时写上的时候,抱的错跟上面一样,所以感觉最后一个能解决OOM的问题,但是引入了新问题 |
添加的位置没问题的,看起来是 scaled_dot_product_attention 只能使用 math_sdp 进行计算,其他方法因为数据类型不支持、显卡不支持的原因无法使用,而 math_sdp 会申请非常大的显存(109 GiB)导致 OOM。 似乎 Quadro rtx 8000 显卡不支持 bfloat16 类型( pytorch/pytorch#67682 (comment) ),而当前模型只支持 bfloat16。 请问有没有更新的显卡可以用来运行该模型呢? |
V100-PCIE-16GB 和 Tesla T4 这两个都是16G显存,刚试了下跑不起来[捂脸] |
是 GPU OOM 吗? 默认的 predict_i2v.py 大约需要 22GB 显存。可以尝试设置 我这边正在尝试是否可以使用 float16 运行,但遇到了一些问题,可能需要修复。如果能够成功使用 float16,我会再留言的。 |
辛苦了,感谢您的帮助,明天我试一下 |
我测试了一下 float16,似乎出现了浮点数精度溢出的问题,因此目前感觉还不适合使用 float16。 建议先尝试使用 |
提示如下:
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 109.01 GiB. GPU 0 has a total capacity of 47.45 GiB of which 27.51 GiB is free. Process 3256 has 19.94 GiB memory in use. Of the allocated memory 18.77 GiB is allocated by PyTorch, and 421.82 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. Seedocumentation for Memory Management
The text was updated successfully, but these errors were encountered: