Error When Processing Epub
Closed this issue · 5 comments
Hi!
It was a pain because pip sometimes got confused with the many dependencies to handle, but I managed to install VoxNovel on debian stable box with 32Gb of ram and less than 8Gb on the graphic card.
I tried to process an epub file, I got this error (I report only the relevant part of the error message).
[...]File "/home/lorenzo/miniconda/lib/python3.11/site-packages/transformers/models/bert/modeling_bert.py", line 363, in forward context_layer = torch.matmul(attention_probs, value_layer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 188.00 MiB. GPU 0 has a total capacity of 7.92 GiB of which 107.25 MiB is free. Including non-PyTorch memory, this process has 7.35 GiB memory in use. Of the allocated memory 6.69 GiB is allocated by PyTorch, and 113.21 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. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
Have I simply run out of memory on the GPU when processing an epub file? Or is there anything else?
Finally, is this fixable of do I need >8Gb of GPU to generate an audiobook from a rather short epub?
Many thanks
Looks like your just running out of Vram when having BOOKNLP processing the book
This can be circumnavigated by forcing the computer to only use the CPU instead of the GPU on the BOOKNLP processing task
allowing it to use your 32 gb ram instead of only 8 gb Vram
I'll see if I can write you a code fix for that
-As for the generating audio requirements,
I can confidently say that I've gotten the audio generation part to run on as little as 4gb Vram on my Gforce GTX 980,
and on cpu only with 4 gb ram (although SUPER slow and in a ubuntu virtual machine, )
I also have a included example test epub file to make sure everything runs fine even with a low Vram or ram.
(It's a very tiny custom epub book I made for testing purposes)
In the Example_working_files.zip
file I have a included mini_story_long - Drew.epub
which can be used to test all of the features of this program while using minimal resources.
The test epub file can be used to test:
-Chapter separation by the program for epub files.
-Multiple character detection.
-Automated Character Gender guessing to make voice actor selection easier and potentially fully automated voice actor selection.
-epub metadata extraction for the final m4b file.
-epub coverArt extraction for the final m4b file.
-Automated chapter separation in m4b final file.
You should be able to fix it by going into gui_run.py
and on
line 310 put this line of code os.environ['CUDA_VISIBLE_DEVICES'] = ''
and on line 461 put this line of code del os.environ['CUDA_VISIBLE_DEVICES']
That will make CUDA not visible to the computer making it run on cpu instead
And then the second line of code will make CUDA visible again after the booknlp processing has been done
Tested it on my end, seems to work!
Thank you and apologies for my small reaction. Is the only solution to apply manually your recommendation? It is a bit strange that you managed to get the work done with smaller vram. What do you mean by super slow in that case? Hours? Days?
ESTIMATED TIMES GPU VS CPU(based on personal experience)
Ebook quotation attribution:
CPU: 10-20 min
GPU: 1-2 minutes
Audio generation(With default high quality XTTS)
CPU: 6 days
GPU(4 gb vram nvidia): 2-3 days
GPU(12 gb vram nvidia): 8-12 hours