구글에 검색해보니 torch.utils.data.DataLoader()에서 num_worker값을 0으로 지정하면 해결이 된다고 하던데

나는 똑같이 에러가 발생함.

 

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.

 

혹시 위와같은 오류문구가 뜨면서 broken pipe error가 난다면

실행하는 소스에

if __name__="__main__":

를 추가해서 다시 실행해보자. 나는 이걸 추가하니 해결이 되었다.

 

 

(참고)

https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing

 

RuntimeError on windows trying python multiprocessing

I am trying my very first formal python program using Threading and Multiprocessing on a windows machine. I am unable to launch the processes though, with python giving the following message. The t...

stackoverflow.com