Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to track progress with nlp.pipe function of spacy?

I'm coding with Python and Spacy. I want to track the progress of the execution of nlp.pipe(sentences) because it lasts a lot. How to do that?

nlp = spacy.load('en_core_web_sm')
sentences = [...]
docs = nlp.pipe(sentences, n_process=8)
like image 314
Marco Avatar asked Oct 30 '25 14:10

Marco


1 Answers

Use tqdm.

from tqdm import tqdm

nlp = spacy.load('en_core_web_sm')
sentences = [...]
for doc in tqdm(nlp.pipe(sentences, n_process=8)):
    ... do stuff ...
like image 103
polm23 Avatar answered Nov 01 '25 06:11

polm23