Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

ProcessPoolExecutor error in writting features #13

Closed
jimbozhang opened this issue Nov 15, 2020 · 2 comments
Closed

ProcessPoolExecutor error in writting features #13

jimbozhang opened this issue Nov 15, 2020 · 2 comments

Comments

@jimbozhang
Copy link
Contributor

An error occurred when I ran the following codes (egs/librispeech/asr/simple_v1/prepare.py:45) on Xiaomi's server (the one with the IP address 10.xx.x.72):

with LilcomFilesWriter(f'{output_dir}/feats_{partition}') as storage, ProcessPoolExecutor(num_jobs, mp_context=multiprocessing.get_context("spawn")) as ex:
        cut_set = CutSet.from_manifests(
            recordings=manifests['recordings'],
            supervisions=manifests['supervisions'])
        cut_set = cut_set.compute_and_store_features(
            extractor=Fbank(),
            storage=storage,
            executor=ex)

The error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  ...
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/usr/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
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.


Traceback (most recent call last):
  File "prepare.py", line 45, in <module>
    cut_set = cut_set.compute_and_store_features(
  File "lhotse/lhotse/cut.py", line 1328, in compute_and_store_features
    cut_set = CutSet.from_cuts(f.result() for f in futures)
  File "lhotse/lhotse/cut.py", line 989, in from_cuts
    return CutSet({cut.id: cut for cut in cuts})
  File "lhotse/lhotse/cut.py", line 989, in <dictcomp>
    return CutSet({cut.id: cut for cut in cuts})
  File "lhotse/lhotse/cut.py", line 1328, in <genexpr>
    cut_set = CutSet.from_cuts(f.result() for f in futures)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

I'm not have experience with ProcessPoolExecutor so I haven't found the reason of this error.

@pzelasko
Copy link
Collaborator

Try the solution that I suggested here lhotse-speech/lhotse#126 (comment)

@jimbozhang
Copy link
Contributor Author

Thanks @pzelasko , it worked. I should search the closed issues before adding a new one 😳

jimbozhang added a commit to jimbozhang/snowfall that referenced this issue Nov 16, 2020
qindazhu added a commit that referenced this issue Nov 16, 2020
Fix the issue #13 by wrapping the codes with a main()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants