batch_size = 2# 256
def get_dataloader_workers(): #@save
"""使用4个进程来读取数据。"""
return 4 train_iter = data.DataLoader(mnist_train, batch_size, shuffle=True, num_workers=get_dataloader_workers()) timer = d2l.Timer()
for X, y in train_iter:
continue
f'{timer.stop():.2f} sec'

问题:动手学深度学习2.0,softmax回归,读取小批量数据是出现超时报错。具体如下:

我的环境是:Anaconda 的虚拟环境,使用jupyter notebook进行编译,电脑是联想拯救者R720,i5处理器;

我所使用的CPU运行,最初是批量256张图片数据,同时使用4线程进行读取,此时会报错!

查阅网上的回答,说最可能的原因是;

  • cuda 虚拟环境的共享内存不足,解决办法是,要么改成更小的batchsize,
  • 将numworkers = 4注释掉,不用多进程

解决过程:


1、只将batchsize改小,变为2,依旧报错

2、将进程num_workers=get_dataloader_workers()改为0、1、2可以使用

估计还是电脑太差了不太行的缘故,毕竟用了快四年了。

 

【Python报错】RuntimeError: DataLoader worker (pid(s) 9764, 15128) exited unexpectedly的更多相关文章

  1. RuntimeError: DataLoader worker (pid 18255) is killed by signal: Killed.

    RuntimeError: DataLoader worker (pid 18255) is killed by signal: Killed. 通过观察内存发现,数据加载过程中内存会被耗尽.

  2. python 报错RuntimeError: dictionary changed size during iteration

    a = {':0} for b in list(a.keys()): if a[b] == 0: del a[b] print(a) 报错是因为在字典迭代期间改变字典大小 我们可以通过取出字典的键值, ...

  3. ssh调用matplotlib绘图报错RuntimeError: Invalid DISPLAY variable

    1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...

  4. 安装tesserocr的步骤和报错RuntimeError: Failed to init API, possibly an invalid tessdata path解决办法

    1,首先下载合适的tesseract-ocr的版本 2,然后安装到这一步注意要勾选这一项来安装OCR识别支持的语言包,这样OCR就可以识别多国语言,然后就可以一直点击下一步完成安装. 3,安装tess ...

  5. Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

    Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...

  6. Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have A

    Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you ...

  7. Python报错总结丶自定义报错

    Python报错总结: 常见异常 1,NameError: name 'a' is not defined:未定义函数名             2,IndentationError: uninden ...

  8. Python报错module 'scipy.misc' has no attribute 'xxx'

    Python报错module 'scipy.misc' has no attribute 'imresize' 解决办法: 安装Pillow包,命令如下: pip install Pillow 然后重 ...

  9. selenium python 报错“ unable to find binary in default location”

    selenium python 报错如下: raise exception_class(message, screen, stacktrace)selenium.common.exceptions.W ...

随机推荐

  1. springboot添加操作

    更多精彩关注微信公众号 Mybaits技术连接数据库 resources #update tomcat port server.port=8888 #config datasource(mysql) ...

  2. 【Web前端HTML5&CSS3】05-样式继承与其他概念

    笔记来源:尚硅谷Web前端HTML5&CSS3初学者零基础入门全套完整版 目录 样式继承与其他概念 1. 继承 2. 选择器的权重 3. 长度单位 像素 屏幕分辨率 图像分辨率 百分比 em ...

  3. 04.06 UCF Local Programming Contest 2017

    A.Electric Bill 题意:简单计算题,超过1000部分额外算 1 #include<stdio.h> 2 int main(){ 3 int money1,money2; 4 ...

  4. 将mysql数据同步到ES6.4(全量+增量)

    下载安装包时注意下载到指定文件夹 这里我放在OPT文件夹下一:安装logstash进入到opt文件夹打开终端 执行以下命令wget -c https://artifacts.elastic.co/do ...

  5. BUAA-OO-第四单元总结——终章

    面向对象第四单元博客总结--终章 第四单元作业设计 第13次作业设计 类和对应方法属性设计 类设计如下图所示 本次作业主要涉及六个类,其中包括主类 Main ,通用Map类 UmlElementIdM ...

  6. 拷贝构造函数第一个参数最好使用const

    拷贝构造函数的第一个参数要求是自身类型的引用,但是没有一定要求具有底层const属性即对常量的引用,但是使用时最好加上const,原因是我们可能在某些"不知道"的情况下对常量对象调 ...

  7. 进程Queue和线程Queue区别

    进程Queue from multiprocessing import Queue q=Queue() 线程Queue import queue q=queue.Queue()

  8. [bug] vscode output 输出乱码

    参考 https://blog.csdn.net/qq_34192032/article/details/105077173 https://blog.csdn.net/a19990412/artic ...

  9. Fio 输出内容的解释

    Fio 输出内容的解释 feilianbb 2016-01-11 16:18:54  27828  收藏 19 文章标签: Linux 存储 Fio SSD 性能   翻译原文来源 https://t ...

  10. stressapptest测试用例testcase方法aarch64

    ### https://github.com/stressapptest/stressapptest aarch64 To build from source, the build/installat ...