Open tamil-phy opened 11 months ago
I am facing the exactly same issue. Until processing for 1 page is done, 27GB is allocated when moving onto second page the memory allocation shoots upto 48GB and gets killed for out of memory error. It runs very well on CPU mode though. Not sure why this happens when using GPU that too for processing just the second page itself.
You can try decreasing the batch size.
For example, --batchsize 8
works well for my Quadro RTX 8000 (with 48GB memory).
Here is the full command I use:
nougat "input.pdf" --out "<output_directory>" --recompute --no-skipping --markdown --model 0.1.0-small --batchsize 8
You can try decreasing the batch size. For example,
--batchsize 8
works well for my Quadro RTX 8000 (with 48GB memory).Here is the full command I use:
nougat "input.pdf" --out "<output_directory>" --recompute --no-skipping --markdown --model 0.1.0-small --batchsize 8
@Hansimov what is the default batch size?
@Hansimov do you know why this woroked? How are sequences & batches created in nougat for a pdf in a nutshell such that reducing the batch size solves the OOM issue?
Even with a reduced batch size, each run of nougat inference leads to increase in GPU memory usage. Eventually, leading to torch.cuda.OutOfMemoryError: CUDA out of memory
.
Is there a memory leak somewhere? I also occasionally saw these warnings from pypdfium2 about memory leaks as mentioned in this issue: https://github.com/facebookresearch/nougat/issues/162
Error Message:
Even if the multiple GPUs are configured to use, nougat does not seem to utilize them.
I did a fresh install of nougat-ocr using pip and running it through a file.