LaTeX-OCR icon indicating copy to clipboard operation
LaTeX-OCR copied to clipboard

CUDA error:out of memory

Open siwuxei opened this issue 1 year ago • 3 comments

Thank you for sharing this project. Recently, while training my model, I encountered the "Cuda error: out of memory" issue when the training reaches halfway. I am using the default configuration file with a batch size of 64. Have you ever encountered this problem before? Can you give me some advice on how to solve this issue without reducing the batch size? (I don't want to reduce the batch size )

siwuxei avatar Apr 11 '23 08:04 siwuxei

image

siwuxei avatar Apr 11 '23 08:04 siwuxei

Hi, the reason are is that the project is working with multiple different image sizes and sequence lengths. It seems like the one of the largest combinations is too big for your memory. You can try to find the batch that breaks or just decrease the max image sizes or max sequence length in the config. https://github.com/lukas-blecher/LaTeX-OCR/blob/6fe881c5a9b7b76c21a790d0593c6e78a323406f/pix2tex/model/settings/config.yaml#L30-L32

lukas-blecher avatar Apr 12 '23 10:04 lukas-blecher

Hi, the reason are is that the project is working with multiple different image sizes and sequence lengths.

It seems like the one of the largest combinations is too big for your memory. You can try to find the batch that breaks or just decrease the max image sizes or max sequence length in the config.

https://github.com/lukas-blecher/LaTeX-OCR/blob/6fe881c5a9b7b76c21a790d0593c6e78a323406f/pix2tex/model/settings/config.yaml#L30-L32

Thank you for your timely response. I will try it out later.

siwuxei avatar Apr 12 '23 10:04 siwuxei