How to change the batch size in a pipeline?


Sorry for the simple question but I was wondering how can I change the batch size when I load a pipeline for sentiment classification.

I use classifier = pipeline('sentiment-analysis') but the list of sentences I feed the classifier is too big to be processed in one batch.


You can do it in the method call:

examples = ["I hate everyone" ] * 100
classifier(examples, batch_size=10)
1 Like