#42 4个工作进程告警,请问怎么解决

Closed
created 1 year ago by maoleqqq · 4 comments
maoleqqq commented 1 year ago
<!-- 需要按照模板,填写每一项内容,请勿改动 --> ### 问题所属任务编号(Task 01-05) task03 softmax回归从零开始实现 ### 运行环境(操作系统版本、Python 版本)/ 非程序问题 python3.9 ### 完整的报错信息(截图或复制均可)/ 问题详细描述 E:\miniconda3\envs\d2l\lib\site-packages\torch\utils\data\dataloader.py:561: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2 (`cpuset` is not taken into account), which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. warnings.warn(_create_warning_msg( ​ ### 描述你期望看到的结果
anine09 commented 1 year ago
Collaborator
你没有说明操作系统版本,但是我预估你是 Windows 10/11,你可以试试将 `num_workers` 设置为 **0**,这是 Windows 下的一个 bug
anine09 added this to the 助教解答过 milestone 1 year ago
anine09 added the
Task 03
label 1 year ago
anine09 added the
程序问题
label 1 year ago
maoleqqq commented 1 year ago
Poster
操作系统是windows10, import torch from IPython import display from d2l import torch as d2l batch_size = 256 train_iter,test_iter = d2l.load_data_fashion_mnist(batch_size) train_iter,test_iter = d2l.load_data_fashion_mnist(batch_size) 我试过将num_workers 设置为 2,但这条指令里没有num_workers这个参数
anine09 commented 1 year ago
Collaborator
oh no,它在 `d2l` 中是写死的数字,你需要在 `d2l/torch.py` 中找到 `get_dataloader_workers` 这个函数,然后将 `return 4` 改为 `return 0`,或者你也可以直接修改 `load_data_fashion_mnist` 的 `num_workers` 为 0,这会涉及到对 `d2l` 包源代码的修改,我建议你在 IDE 或者代码编辑器中完成 ![1680004186277](/attachments/96dc1679-3c07-4d07-b3cb-e92d2f21ae11)
maoleqqq commented 1 year ago
Poster
谢谢
anine09 closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.