可能原因:文件为空。
解决办法:加载非空文件。
其他解决办法:
1、加载前判断文件是否为空import os
scores = {} # scores is an empty dict already
if os.path.getsize(target) > 0:      with open(target, "rb") as f:unpickler = pickle.Unpickler(f)# if file is not empty scores will be equal# to the value unpickledscores = unpickler.load()2、捕获异常open(target, 'a').close()
scores = {};
try:with open(target, "rb") as file:unpickler = pickle.Unpickler(file);scores = unpickler.load();if not isinstance(scores, dict):scores = {};
except EOFError:return {}

torch EOFError: Ran out of input相关推荐

  1. python异常之EOFError: Ran out of input

    python异常之EOFError: Ran out of input 参考文章: (1)python异常之EOFError: Ran out of input (2)https://www.cnbl ...

  2. EOFError: Ran out of input

    项目场景:对于序列化字节文件读取数据时 import pickle db = pickle.load(dbfile) 问题描述:文件操作模式匹配问题 EOFError: Ran out of inpu ...

  3. (已解决)EOFError: Ran out of input

    如图所示. 这个问题是因为pickle.load()读取的文件为空导致,加个容错: <EOFError: Ran out of input>

  4. 使用pytorch时,遇到Can‘t pickle local object ‘xxx.<locals>.<lamba>‘的问题,注释有关部分有EOFError: Ran out of input问题

    如图,出现报错Can't pickle local object 'xxx..' 直接按照报错信息查网上,有许多可能的解答,有 pickle有限制,无法解析我模型文件中的lambda表达式 pickl ...

  5. python Ran out of input 异常解决

    Ran out of input 我在pytorch测试DataLoader时报错,代码: testloader = DataLoader(test, batch_size=16, shuffle=T ...

  6. python报错Ran out of input

    报错显示: 首先进行Traceback,发现报错语句为:pickle.load() 之后网上查找原因有: (1)https://www.cnblogs.com/rychh/p/9833318.html ...

  7. Ran out of input

    空文件创建 xxx.txt open加载 pickle 加载

  8. 【gensim问题记录】EOFError: unexpected end of input; is count incorrect or file otherwise damaged?

    参考博客 报错信息: 打开词向量文件 vi glove.840B.300d.word2vec.txt 词向量文件中的第一行是两个数字,第一个表示此文件中共有词多少:第二个是词向量的维度 输入crtl+ ...

  9. PyCharm跑项目时遇到的一些问题及解决办法

    PyCharm PyTorch deep learing project author:zoxiii 文章目录 问题1 问题2 问题3 问题4 问题5 问题6 问题7 问题8 问题9 问题10 问题1 ...

最新文章

  1. CORE协议的MATLAB仿真
  2. 与variant有关的几个FUNCTION
  3. MongoDB数据库(了解MongoDB及基础命令,备份数据库)
  4. tableview或scrollview Y轴发生变化解决方案
  5. 理想职业计算机程序英语作文,Choosing the Right Career理想的职业英语作文
  6. Unity3D 协程 浅谈
  7. Python基础篇【第十篇】:正则表达式
  8. django multidb --- router
  9. Google Analytics10条有用教程
  10. ubuntu 更新源 或者 apt-get install 出错404 not found ,Failed to fetch
  11. java接口的关键字_java关键字-interface
  12. java token 超时_前后端分离——token超时刷新策略
  13. 西门子水处理1200PLC程序+触摸屏程序,博图V16学习程序,可仿真实验 Plc程序包含功能块,功能块为SCL编写
  14. PHP图片添加文字水印或海报
  15. 培训班出来的程序员怎么就不行了?
  16. 外贸企业邮箱可以撤回邮件吗?如何撤回已发送的邮件?
  17. Android移动应用程序开发
  18. 拉美外贸: 哥伦比亚网银支付PSE
  19. Java面试之语言基础
  20. OpenStack Victoria搭建(一)简介

热门文章

  1. Direct2D介绍
  2. VC++运算符与优先级
  3. Linux 多线程编程
  4. Java--Dom解析XML文件
  5. Linux C编程--打开和关闭流
  6. 怎么看待传菜机器人_太科幻了!这家顺德菜餐厅里全是机器人,炒菜送菜样样行...
  7. 极光 php 自定义消息,laravel框架使用极光推送消息操作示例
  8. 问题集锦(41-42)
  9. linux环境下运行open error,错误:运行OpenCL代码时clGetPlatformIDs -1001(Linux)
  10. java中顺式和链式_Java单链表顺序和链式实现(数据结构五)