Skip to content

How to enable multiprocessing with GLiNER ? #281

Closed Answered by OrianeN
OrianeN asked this question in Q&A
Discussion options

You must be logged in to vote

I've found out that since PyTorch uses multithreading, forking processes is not possible ; however the "spawn" method works:

if __name__ == "__main__":  
    set_start_method("spawn")
    corpus = ["My name is Franz Schubert.", "Ella Fitzgerald is my favorite singer."]  
    pip = MyPipeline()  
    pip.preprocess_lines(corpus)

In my case, I also changed my code to avoid unpickling the MyPipeline instance for each sample, but at least it is possible to do multiprocessing with GLiNER.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by OrianeN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant