continue-revolution / sd-webui-segment-anything

Segment Anything for Stable Diffusion WebUI
3.37k stars 204 forks source link

[Bug]: 10G显存溢出 #140

Open zhang-jie8 opened 1 year ago

zhang-jie8 commented 1 year ago

Is there an existing issue for this?

Have you 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?

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

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?

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

zdoek001 commented 4 months ago

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