版权声明:本文为博主原创文章,欢迎转载,并请注明出处。联系方式:460356155@qq.com

RuntimeError: received 0 items of ancdata错误是在dataloader加载数据时出现的错误,原因是pytorch多线程共享tensor是通过打开文件的方式实现的,而打开文件的数量是有限制的,通过

ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 128088
max locked memory       (kbytes, -l) 16384
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 128088
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

可查看,当需共享的tensor超过open files限制时,即会出现该错误。

解决办法有2种:

1、增加open files的限制数量:

不能用sudo ulimit -n命令,而需执行:

sudo sh -c "ulimit -n 65535 && exec su $LOGNAME"

解释如下:

ulimit is a shell builtin like cd, not a separate program. sudo looks for a binary to run, but there is no ulimit binary, which is why you get the error message. You need to run it in a shell.
However, while you do need to be root to raise the limit to 65535, you probably don’t want to run your program as root. So after you raise the limit you should switch back to the current user.
To do this, run:
sudo sh -c "ulimit -n 65535 && exec su $LOGNAME"
and you will get a new shell, without root privileges, but with the raised limit. The exec causes the new shell to replace the process with sudo privileges, so after you exit that shell, you won’t accidentally end up as root again.

2、修改多线程的tensor方式为file_system(默认方式为file_descriptor,受限于open files数量):

torch.multiprocessing.set_sharing_strategy('file_system')

pytorch错误:RuntimeError: received 0 items of ancdata解决的更多相关文章

  1. Error:dijit.tree.TreeStoreModel:root query returned 0 items

    1.错误描述 error loading root:                                            Tree.js(第341行) Error:dijit.tre ...

  2. 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法

    使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法 添加一行 manager. ...

  3. jQuery ajax请求错误返回status 0和错误error的问题

    上周发现一个jQuery ajax请求错误返回status 0和错误error的问题,responseText是"error",状态码是0而不是200: $.ajax({ type ...

  4. 错误:google-chrome-stable-44.0.2403.157-1.x86_64.rpm 的公钥没有安装

    错误:google-chrome-stable-44.0.2403.157-1.x86_64.rpm 的公钥没有安装 Fedora22 系统更新软件包.出现: warning: /var/cache/ ...

  5. MVC4发布到IIS,出现HTTP 错误 404.0 - Not Found的解决方法

    MVC4发布到IIS,出现HTTP 错误 404.0 - Not Found的解决方法 1.出现的错误页面

  6. Win7系统安装好Axure点击运行报.NET Framework4.0未安装的解决办法

      1:问题 由于工作需要,需要研究一下Axure原型设计软件的使用方式,在公司的电脑上成功安装了从同事那里拿来的Axure7.0软件,能够正确运行没有任何问题,在自己的电脑上安装的也非常顺利,不过运 ...

  7. PHP:错误 Deprecated: Function split() is deprecated in ... 解决办法

    PHP:错误 Deprecated: Function split() is deprecated in ... 解决办法 PHP5.3 split() 不建议使用的原因:PHP 5.3.0 之后的r ...

  8. 使用.netFx4.0提供的方法解决32位程序访问64位系统的64位注册表

    原文:使用.netFx4.0提供的方法解决32位程序访问64位系统的64位注册表 我们知道目标平台是32位的程序运行在64位的系统上,去访问部分注册表的时候系统自动重定向到win32node节点对应的 ...

  9. windows tensorboard http://0.0.0.0:6006 无法访问 解决方法 - using chrome and localhost as ip

    启动命令: tensorboard --logdir="tensorboard" 启动后显示 Starting TensorBoard b'47' at http://0.0.0. ...

随机推荐

  1. Linux知识要点大全(第二章)

    第二章   linux操作系统安装与配置主要内容 1:vmware虚拟机安装与使用 2:Linux系统安装前准备 3:Linux Centos 系统的安装 4:Centos 6.8的登录和关闭 5:C ...

  2. WebApiClient的接口输入验证

    1. 文章目的 随着WebApiClient的不断完善,越来越多开发者选择WebApiClient替换原生的HttpClient,本文将介绍WebApiClient的接口参数输入有效性验证的新特性. ...

  3. Reactive Extensions 相见恨晚的Rx.Net

    何为Reactive Extensions(Rx) Rx是一个遵循函数式编程的类库,它引用观察者以及迭代器设计模式对可观察对象产生的数据进行异步消费.使用Rx, 开发人员将使用LINQ运算符操作异步数 ...

  4. PHP基础笔记

    今天一个阳光明媚的大周天,小崔百无聊赖的翻看着各种老旧的经典电影,无奈谁让自己是没女朋友的单身狗呢.闲来无事就记录一下PHP的一些基础知识吧! 1.PHP是什么? PHP是一种创建动态交互性站点的服务 ...

  5. Linux常用查找命令

    第一种:grep命令 示例: 第二种:find命令 示例: 第三种:locate命令 示例: 第四种:whereis命令 示例: 第五种:which命令 示例:

  6. Ocelot + Consul + Registrator 基于Docker 实现服务发现、服务自动注册

    目录 1. Consul集群搭建 1.1 F&Q Consul官方推荐的host网络模式运行 2. Registrator服务注册工具 2.1 F&Q Registrator悬挂服务 ...

  7. ButterKnife 牛油刀使用

    一.butterknife介绍 ①官网 butterknife ②Field and method binding for Android Views which uses annotation pr ...

  8. Fragment嵌套Fragment时候。子类fragment调用父容器Fragment方法

    业务场景:有的时候我们的页面可能是Activity 嵌套多个Fragment ..其中某个Fragment 又嵌套多个Fragment. 其中某个子Fragment  定义为  NewsFragmen ...

  9. 简单易懂的单元测试框架-gtest(二)

    简介     事件机制用于在案例运行前后添加一些操作(相当于挂钩函数).目前,gtest提供了三种等级的事件,分别: 全局级,所有案例执行的前后 TestSuite级,某一个案例集的前后 TestCa ...

  10. SQL SERVER 2012 AlwaysOn– 数据库层面 02

    搭建 AlwaysOn 是件非常繁琐的工作,需要从两方面考虑,操作系统层面和数据库层面,AlwaysOn 非常依赖于操作系统,域控,群集,节点等概念: DBA 不但要熟悉数据库也要熟悉操作系统的一些概 ...