-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FARMReader parallelism issues #3289
Comments
Hi @danielbichuetti thanks for opening the issue. This may be related to the multiprocessing in the reader = FARMReader(model_name_or_path="MODEL_NAME", num_processes=0) and see if that prevents this thread locking from happening? |
Hello @sjrl Thank you for your suggestion. It worked. It seems to be not a thread locking but a deadlock because of the multiprocessing. After the suggested change, all cores were used, and no deadlocks. |
@vblagoje @Timoeller This sounds like another good reason to remove multiprocessing from the |
Just to keep as a note, after setting FARMReader
TransformersReader
This is a good first sight that disabling multiprocessing in FARMReader, its performance is still superior to TransformersReader default setting. |
@Timoeller @vblagoje Tagging you guys to check out the above timings in regards to issue #3272 |
@danielbichuetti can you confirm that you used the same models in the readers? I ran tests similar to this one several times, and my measurements indicated TransformersReader is slightly faster (by ~ 15%). I didn't rely on colab but ran the tests directly on bare-metal to minimize discrepancies. |
When I received the notification about the performance on the other topic, I started a new test using your notebook and same dataset. The only difference I could see at first is that I tested with GPU disabled, only CPU working. Tests are being done in an Xeon 8 CPU 56 GB RAM in Azure ML Studio. As soon the tests finish (I'll run it 10 times, just to be certain), I'll post the update. UPDATE: I just checked the model when FARMReader outperformed TransformersReader, it was |
@vblagoje These are the results (median): Hardware: 8vCPU Intel® Xeon® Platinum 8370C (Ice Lake) / 56 GB RAM / 400 GB SSD Individual document, multiple calls, CPUFARMReader
TransformersReader
List of documents, one call, CPUFARMReader
TransformersReader
However, I got interesting results when running an ExtractiveQAPipeline, using FARMReader (median Wall time: 1m 34s) vs. TransformersReader (median Wall time: 1m 32s). The tests were done using OpenSearchDocumentStore, a BM25Retriever and the Reader. I have run them 10 times, results were similar to my first tests in 4 cases, there were 2 deadlocks where FARMReader stopped using CPU, and 4 runs where TransformersReader was superior. This can be a result off:
The deadlock is a rare situation when running FARMReader with These are the used pipelines:
You can contact me privately, so I can share credentials (it's an internal testing store, in two flavors, giant documents, small documents) to the DocumentStore. |
Describe the bug
When running FARMReader, without a GPU, it spawns the inferencers, start processing, but suddenly all process goes to 0% CPU usage, and it never returns any results. I noticed that despise it spawning 7 inferencers, it's using just 1 CPU core.
This has been tested on a notebook, and on 3 Azure instances.
When using TransformersReader, the same setup (models, instances, document stores), the Reader spawns 7 inferencers, but 7 CPU cores get fully used. Results appears under 11m5s.
Error message
FARMReader get in a deadlock state
Expected behavior
Reader should use all CPU cores (it's not limited by any command), like TransformersReader, and should return results
Additional context
To Reproduce
Create a DocumentStore, create a BM25Retriever, crete a FARMReader, use ExtractiveQA pipeline to run the prediction query.
FAQ Check
System:
The text was updated successfully, but these errors were encountered: