栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

TypeError: unlink() got an unexpected keyword argument ‘missing

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

TypeError: unlink() got an unexpected keyword argument ‘missing

在谷歌服务器colab上跑yolo代码,训练自己的yolov5模型,遇到这个错误,可把我整不会了。。。

已经做好了数据集,建立了新的data下的yaml和model下的yaml文件,然后使用代码

!python train.py

运行train.py,但是出现了下面的问题:

Download error: [Errno 2] No such file or directory: '/content/drive/mydrive/yolov5-5.0/tmpnipjyz8i' Traceback (most recent call last): File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 39, in attempt_download torch.hub.download_url_to_file(url, file) File "/usr/local/lib/python3.7/dist-packages/torch/hub.py", line 471, in download_url_to_file f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir) File "/usr/lib/python3.7/tempfile.py", line 686, in NamedTemporaryFile (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type) File "/usr/lib/python3.7/tempfile.py", line 397, in _mkstemp_inner fd = _os.open(file, flags, 0o600) FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/mydrive/yolov5-5.0/tmpnipjyz8i' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 43, in attempt_download assert redundant, 'No secondary mirror' AssertionError: No secondary mirror During handling of the above exception, another exception occurred: Traceback (most recent call last): File "train.py", line 543, in train(hyp, opt, device, tb_writer) File "train.py", line 86, in train attempt_download(weights) # download if not found locally File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 49, in attempt_download file.unlink(missing_ok=True) # remove partial downloads 

TypeError: unlink() got an unexpected keyword argument 'missing_ok'

具体见下图:

你是不是也这样了呢?

去网上找了几方法,发现自己看不懂或者是步适合自己的问题。。。。。

然后,我就看到了这一段提示

于是我就死马当做活马医,试着删掉这一行代码,然后重新使用代码

!python train.py

于是乎奇迹般地运行了,惊呆了老铁!

删掉的代码的位置在utils文件下的google_utiols.py 第49行上,删了它!

出现这个问题的可以试试本方法,如果有问题欢迎留言一起讨论,一起进步!

小白浅浅记录一波........期待后续更新

更多干货可以关注“蓝胖胖干货”,一枚励志带来干货的博主,和你一起进步!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/853456.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号