Question answering example errors with BrokenPipeError: [Errno 32] Broken pipe
Author: Code4SAFrankie
Pull request: no
Labels: name: wontfix

## Environment info
- `transformers` version: 3.3.1
- Platform: Windows-10-10.0.18362-SP0
- Python version: 3.7.1
- PyTorch version (GPU?): 1.4.0+cpu (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: No
### Who can help
No option for question answering in your list

## Information

question-answering pipeline example was used.

The problem arises when using:
the official example scripts

The tasks I am working on is:
question-answering

## To reproduce

Steps to reproduce the behavior:

1. Run
```

from transformers import pipeline

# From https://huggingface.co/transformers/usage.html

nlp = pipeline("question-answering")

context = r"""
Extractive Question Answering is the task of extracting an answer from a text given a question. An example of a
question answering dataset is the SQuAD dataset, which is entirely based on that task. If you would like to fine-tune
a model on a SQuAD task, you may leverage the `run_squad.py`.
"""

print(nlp(question="What is extractive question answering?", context=context))
print(nlp(question="What is a good example of a question answering dataset?", context=context))
```

2. Get error:
```

I1018 21:00:26.369285 15020 filelock.py:274] Lock 2310999501064 acquired on C:\Users\User/.cache\torch\transformers\c2341a51039a311cb3c7dc71b3d21970e6a127876f067f379f8bcd77ef870389.6a09face0659d64f93c9919f323e2ad4543ca9af5d2417b1bfb1a36f2f6b94a4.lock
Downloading: 100%|███████████████████████████████████████████████████████████████████████| 473/473 [00:00<00:00, 118kB/s]
I1018 21:00:27.404981 15020 filelock.py:318] Lock 2310999501064 released on C:\Users\User/.cache\torch\transformers\c2341a51039a311cb3c7dc71b3d21970e6a127876f067f379f8bcd77ef870389.6a09face0659d64f93c9919f323e2ad4543ca9af5d2417b1bfb1a36f2f6b94a4.lock
I1018 21:00:28.506618 15020 filelock.py:274] Lock 2310999482320 acquired on C:\Users\User/.cache\torch\transformers\cee054f6aafe5e2cf816d2228704e326446785f940f5451a5b26033516a4ac3d.e13dbb970cb325137104fb2e5f36fe865f27746c6b526f6352861b1980eb80b1.lock
Downloading: 100%|█████████████████████████████████████████████████████████████████████| 213k/213k [00:00<00:00, 299kB/s]
I1018 21:00:30.234217 15020 filelock.py:318] Lock 2310999482320 released on C:\Users\User/.cache\torch\transformers\cee054f6aafe5e2cf816d2228704e326446785f940f5451a5b26033516a4ac3d.e13dbb970cb325137104fb2e5f36fe865f27746c6b526f6352861b1980eb80b1.lock
I1018 21:00:31.294145 15020 filelock.py:274] Lock 2310999651048 acquired on C:\Users\User/.cache\torch\transformers\414816afc2ab8922d082f893dbf90bcb9a43f09838039249c6c8ca3e8b77921f.455d944f3d1572ab55ed579849f751cf37f303e3388980a42d94f7cd57a4e331.lock
Downloading: 100%|██████████████████████████████████████████████████████████████████████| 230/230 [00:00<00:00, 51.5kB/s]
I1018 21:00:32.335124 15020 filelock.py:318] Lock 2310999651048 released on C:\Users\User/.cache\torch\transformers\414816afc2ab8922d082f893dbf90bcb9a43f09838039249c6c8ca3e8b77921f.455d944f3d1572ab55ed579849f751cf37f303e3388980a42d94f7cd57a4e331.lock
I1018 21:00:33.984491 15020 filelock.py:274] Lock 2310999583152 acquired on C:\Users\User/.cache\torch\transformers\3efcb155a9475fe6b9318b8a8d5278bce1972d30291f97f2a8faeb50d02acabc.087b9fac49619019e540876a2d8ecb497884246b5aa8c9e8b7a0292cfbbe7c52.lock
Downloading: 100%|████████████████████████████████████████████████████████████████████| 261M/261M [00:42<00:00, 6.14MB/s]
I1018 21:01:16.665997 15020 filelock.py:318] Lock 2310999583152 released on C:\Users\User/.cache\torch\transformers\3efcb155a9475fe6b9318b8a8d5278bce1972d30291f97f2a8faeb50d02acabc.087b9fac49619019e540876a2d8ecb497884246b5aa8c9e8b7a0292cfbbe7c52.lock
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 105, in spawn_main
Traceback (most recent call last):
  File "e:\Work\Python\transformers_question_answering.py", line 11, in <module>
        exitcode = _main(fd)print(nlp(question="What is extractive question answering?", context=context))

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 114, in _main
  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\pipelines.py", line 1691, in __call__
    prepare(preparation_data)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 225, in prepare
    for example in examples
_fixup_main_from_path(data['init_main_from_path'])  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\pipelines.py", line 1691, in <listcomp>

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "E:\WPy-3710\python-3.7.1.amd64\lib\runpy.py", line 263, in run_path
    for example in examples
  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\data\processors\squad.py", line 345, in squad_convert_examples_to_features
    pkg_name=pkg_name, script_name=fname)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\runpy.py", line 96, in _run_module_code
    with Pool(threads, initializer=squad_convert_example_to_features_init, initargs=(tokenizer,)) as p:
      File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\context.py", line 119, in Pool
mod_name, mod_spec, pkg_name, script_name)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "e:\Work\Python\transformers_question_answering.py", line 11, in <module>
    print(nlp(question="What is extractive question answering?", context=context))
  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\pipelines.py", line 1691, in __call__
    for example in examples
  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\pipelines.py", line 1691, in <listcomp>
    for example in examples
  File "E:\WPy-3710\python-3.7.1.amd64\lib\site-packages\transformers\data\processors\squad.py", line 345, in squad_convert_examples_to_features
    with Pool(threads, initializer=squad_convert_example_to_features_init, initargs=(tokenizer,)) as p:
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\context.py", line 119, in Pool
        context=self.get_context())context=self.get_context())

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 177, in __init__
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 177, in __init__
        self._repopulate_pool()self._repopulate_pool()

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
    self._wrap_exception)
      File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
self._wrap_exception)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
    w.start()
      File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\process.py", line 112, in start
w.start()
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\process.py", line 112, in start
        self._popen = self._Popen(self)self._popen = self._Popen(self)

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\context.py", line 322, in _Popen
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    return Popen(process_obj)
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
        prep_data = spawn.get_preparation_data(process_obj._name)reduction.dump(process_obj, to_child)

  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\reduction.py", line 60, in dump
    _check_not_importing_main()
  File "E:\WPy-3710\python-3.7.1.amd64\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.ForkingPickler(file, protocol).dump(obj)

BrokenPipeError: [Errno 32] Broken pipe
```

## Expected behavior

Output:

```
{'score': 0.622232091629833, 'start': 34, 'end': 96, 'answer': 'the task of extracting an answer from a text given a question.'}
{'score': 0.5115299158662765, 'start': 147, 'end': 161, 'answer': 'SQuAD dataset,'}
```


Comments:
Same problem

This was patched on `master`, cannot reproduce anymore. Can you reproduce on `master`?

> This was patched on `master`, cannot reproduce anymore. Can you reproduce on `master`?

I installed the newest version (3.4.0) by pip, but this problem still arises.

Facing the same issue with 3.5.1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


Fixed on version 4.0.1

transformers 4.0.1??