continue-revolution/sd-webui-segment-anything

[Bug]: 10G显存溢出

zhang-jie8 opened this issue · 1 comments

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

Have you updated WebUI and this extension to the latest version?

  • I have updated WebUI and this extension to the latest version

Do you understand that you should read the 1st item of https://github.com/continue-revolution/sd-webui-segment-anything#faq if you cannot install GroundingDINO?

  • My problem is not about installing GroundingDINO

Do you understand that you should use the latest ControlNet extension and enable external control if you want SAM extension to control ControlNet?

  • I have updated ControlNet extension and enabled "Allow other script to control this extension"

Do you understand that you should read the 2nd item of https://github.com/continue-revolution/sd-webui-segment-anything#faq if you observe problems like AttributeError bool object has no attribute enabled and TypeError bool object is not subscriptable?

  • My problem is not about such issue, otherwise I have tried changing the extension directory name from sd-webui-segment-anything to a1111-sd-webui-segment-anything

What happened?

平时显存为3.8G左右,使用sam api接口后显存占用到6.8G,多出的3G显存不会释放,会一直保持在6.8G显存占用。并且在调用接口时仍然提示,此时实际显存占用为6.8G:
{"error":"OutOfMemoryError","detail":"","body":"","errors":"CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 9.77 GiB total capacity; 8.50 GiB already allocated; 910.69 MiB free; 8.58 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_ALLOC_CONF"}

Steps to reproduce the problem

/sam/sam-predict API

What should have happened?

{"error":"OutOfMemoryError","detail":"","body":"","errors":"CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 9.77 GiB total capacity; 8.50 GiB already allocated; 910.69 MiB free; 8.58 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_ALLOC_CONF"}

Commit where the problem happens

降低显存占用

What browsers do you use to access the UI ?

No response

Command Line Arguments

Console logs

{"error":"OutOfMemoryError","detail":"","body":"","errors":"CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 9.77 GiB total capacity; 8.50 GiB already allocated; 910.69 MiB free; 8.58 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_ALLOC_CONF"}

Additional information

No response

同样的问题 莫名会占用几G显存不会释放