-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Training requires too much RAM #285
Comments
Do you use data augmentation? There is a
|
No, I don't use data augmentation at the moment. I saw the I think the central point is not preloading, but keeping intermediate data from the data processors. But of course I still don't now the internals of Calamari, so I might be wrong with that assumption. |
I have had the same issue as @stweil. I tested to run calamari-cross-fold-train with multiple folds on a larger dataset but with only one process in parallel. While monitoring the available free RAM it was possible to see how it decreased noticeably for each fold that was trained. Eventually, the computer ran out of free ram and the process froze. Is this expected behaviour, or could it (as stweil mentions) be because the memory used by the data processors is not released? As mentioned, reducing memory requirements would be highly useful for training multifold models on larger datasets |
Since I did not run any larger trainings currently, I have no experience with this memory leak myself. Digging through the code of cross-fold-train, I found that the training processes are run in separate processes, even if they are started from the same thread when max_parallel_models == 1. Could it be that the OS is somehow not freeing the memory even after the training process ends? |
I don't think that there is a memory leak. The data processors require a lot of memory, and I wonder whether that memory is still needed after a processor has done its job. Maybe it is sufficient to reset some Python variables which hold the data of a processor. |
You're right, killing the processes would only remedy the additional problems @jacoborrje encountered. |
Training with a large number of lines requires a huge amount of RAM (52 GiB RAM for 375000 lines). Loading the samples into memory contributes only a smaller part to this. Most memory is used by the following data processors (CenterNormalizerProcessor, FinalPreparation, BidiTextProcessor, ...). It looks like the memory which is used for these processors is not released in later steps. Maybe that can be changed by throwing away data which is no longer used.
Reducing the memory requirements is especially important for
calamari-cross-fold-train
which currently has to be restricted to a subset of folds even on a large server with 128 GiB of RAM.The text was updated successfully, but these errors were encountered: