Skip to content

Runtime error attemp to start a new process before the current process

Solution

As the note said, add __main__`` guard and addfreeze_support()` and the begining.

if __name__ == "__main__":
    # multiprocessing.freeze_support() # may be not needed
    start = time.time()
    ...

Ref:

https://discuss.pytorch.org/t/runtimeerror-an-attempt-has-been-made-to-start-a-new-process-before-the-current-process-has-finished-its-bootstrapping-phase/145462/9