AssertionError: daemonic processes are not allowed to have children
I keep on getting this AssertionError when I try to use FlagEmbedding outside of the provided sample. Can you provide an example of getting around this problem?
The code I am getting error may be here:
from FlagEmbedding import LayerWiseFlagLLMReranker reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_fp16=True)
or here:
scores = [reranker.compute_score([query, passage], cutoff_layers=cutoff_layers) for query, passage in pairs]
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:04<00:00, 1.40s/it] 0%| | 0/1 [00:00<?, ?it/s] daemonic processes are not allowed to have children
Seems like you encountered errors while using multiprocessing. You could try setting multiprocessing.set_start_method('spawn') before multiprocessing.Process to address this issue.
I am calling literally sample code from fastapi code and I get this error. Any resolution since I am not using multiprocessing.
This indeed appears to be an error caused by multiprocessing. You can import multiprocessing and then try setting multiprocessing.set_start_method('spawn').
I have tried the following:
- mulitprocessing
- concurrent.futures
- threading
to get around this problem. Now, I am about to try Celery to go around this problem.
Could you please provide more code? We want to analyze the code to identify the cause since the specific error location is unclear.
The code fails here with this error when called from fastapi -> daemonic processes are not allowed to have children
scores = [reranker.compute_score([query, passage], cutoff_layers=cutoff_layers) for query, passage in pairs]
ok. I found the culprit - it is hypercorn. Your code conflicts with hypercorn.
Closing this issue since it is not error with FlagEmbedding.