BufferedWriter takes most of the time
I did a quick profiling of the QA pipeline and found the most time consuming part is IO:6256 function calls (6155 primitive calls) in 1.097 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    1    0.713    0.713    0.713    0.713 {method 'write' of '_io.BufferedWriter' objects}
   37    0.229    0.006    0.229    0.006 {method 'matmul' of 'torch._C._TensorBase' objects}
   12    0.030    0.002    0.030    0.002 {built-in method matmul}
    5    0.020    0.004    0.020    0.004 {method 'dump' of '_pickle.Pickler' objects}
    6    0.019    0.003    0.019    0.003 {method 'softmax' of 'torch._C._TensorBase' objects}
   33    0.012    0.000    0.012    0.000 {method 'acquire' of '_thread.lock' objects}
    3    0.009    0.003    0.009    0.003 {built-in method posix.waitpid}
    6    0.009    0.002    0.009    0.002 {method 'masked_fill_' of 'torch._C._TensorBase' objects}
    6    0.009    0.001    0.009    0.001 {built-in method torch._C._nn.gelu}
   37    0.006    0.000    0.235    0.006 functional.py:1655(linear)
 94/1    0.005    0.000    0.325    0.325 module.py:710(_call_impl)
...I am testing on a macbook using CPU and pytorch backend. Did I do somthing wrong or is this normal? How I can improve the speed if I need to run this thousands of time? Below is the notebook code I used:english = pipeline(
    "question-answering",
    model="distilbert-base-uncased-distilled-squad",
    tokenizer="distilbert-base-uncased-distilled-squad"
)

text1 = """It comes as pubs, bars, restaurants and other hospitality venues in England are told they must have a 22:00 closing time from Thursday.

Full details will be set out by the prime minister in Parliament later.

Boris Johnson is meeting the first ministers of Scotland, Wales and Northern Ireland and will address the nation in a live broadcast at 20:00 BST on Tuesday.

As well as the early closing time for hospitality venues, he is expected to announce they will be restricted by law to table service only.
"""

%%prun
english({'question': 'Which country is the news about?', 'context': text1})