Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch-cifar复现问题 #142

Open
FYM1209 opened this issue Dec 9, 2021 · 4 comments
Open

pytorch-cifar复现问题 #142

FYM1209 opened this issue Dec 9, 2021 · 4 comments

Comments

@FYM1209
Copy link

FYM1209 commented Dec 9, 2021

我直接把作者的文件都下来,在pycharm打开运行main.py,为什么出这些错
prep_data = spawn.get_preparation_data(process_obj._name)
File "F:\Download\envs\pytorch\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "F:\Download\envs\pytorch\lib\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.

image

@Dabu9
Copy link

Dabu9 commented Dec 16, 2021

相同情况,还没找到解决办法

@fzjcdt
Copy link

fzjcdt commented Dec 28, 2021

num_workers=0

@henryzhuhr
Copy link

要把代码放在if name == 'main':里面才不会报错

@samrere
Copy link

samrere commented Feb 9, 2022

我问过一样的问题:
https://discuss.pytorch.org/t/dataloader-worker-failed/140518
Windows系统都这样。要么让num_worker = 0; 要么把代码放在 if name == 'main': 里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants