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

ch1.4训练一个分类器中可能存在多进程报错的问题 #145

Open
hebf181 opened this issue Sep 15, 2024 · 0 comments
Open

ch1.4训练一个分类器中可能存在多进程报错的问题 #145

hebf181 opened this issue Sep 15, 2024 · 0 comments

Comments

@hebf181
Copy link

hebf181 commented Sep 15, 2024

使用的是macos系统。在运行过程中存在多进程报错的问题,应该在
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
shuffle=True, num_workers=0)
以及

testloader = torch.utils.data.DataLoader(testset, batch_size=4,
shuffle=False, num_workers=0)
中设置进程数目为0
或者在训练的过程中使用if name=='main':将训练过程包起来。这样就可以正常运行不报错了。

多进程加载数据在windows系统中也不支持,在linux中可以。
转载自CSDN。
pytorch小白,欢迎交流

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

1 participant