bert_chinese_pytorch icon indicating copy to clipboard operation
bert_chinese_pytorch copied to clipboard

EOFError: Compressed file ended before the end-of-stream marker was reached

Open Zhaohaoran1997 opened this issue 5 years ago • 7 comments

抱歉打扰您。我在运行过程中又遇到了模型出错问题。 这个问题我在pytor_pretrained_bert的issue里看到过,但作者说2018年11月就已经解决了这个问题,我看我现在运行的代码中也包含了修正后的部分。不知道我这现在是什么情况?

Zhaohaoran1997 avatar Apr 23 '19 14:04 Zhaohaoran1997

Traceback (most recent call last): File "bert.py", line 655, in main() File "bert.py", line 545, in main args.local_rank), num_labels=len(label_list)) File "/home/zhaohaoran/anaconda3/lib/python3.7/site-packages/pytorch_pretrained_bert/modeling.py", line 573, in from_pretrained archive.extractall(tempdir) File "/home/zhaohaoran/anaconda3/lib/python3.7/tarfile.py", line 2002, in extractall numeric_owner=numeric_owner) File "/home/zhaohaoran/anaconda3/lib/python3.7/tarfile.py", line 2044, in extract numeric_owner=numeric_owner) File "/home/zhaohaoran/anaconda3/lib/python3.7/tarfile.py", line 2114, in _extract_member self.makefile(tarinfo, targetpath) File "/home/zhaohaoran/anaconda3/lib/python3.7/tarfile.py", line 2163, in makefile copyfileobj(source, target, tarinfo.size, ReadError, bufsize) File "/home/zhaohaoran/anaconda3/lib/python3.7/tarfile.py", line 247, in copyfileobj buf = src.read(bufsize) File "/home/zhaohaoran/anaconda3/lib/python3.7/gzip.py", line 276, in read return self._buffer.read(size) File "/home/zhaohaoran/anaconda3/lib/python3.7/_compression.py", line 68, in readinto data = self.read(len(byte_view)) File "/home/zhaohaoran/anaconda3/lib/python3.7/gzip.py", line 482, in read raise EOFError("Compressed file ended before the " EOFError: Compressed file ended before the end-of-stream marker was reached

Zhaohaoran1997 avatar Apr 23 '19 14:04 Zhaohaoran1997

@liuyijiang1994

Zhaohaoran1997 avatar Apr 23 '19 14:04 Zhaohaoran1997

这个看上去感觉是下载下来的压缩文件解压失败 可能是下载的文件不完整或者是已经存在要下载但是没下载完的文件报的错,可以试试删除你的bert pretrained下载的那部分内容,对应的是from_pretrained方法中cache_dir这个目录

liuyijiang1994 avatar Apr 24 '19 01:04 liuyijiang1994

from_pretrained

可是cache文件夹我已经删除重下好几次了

Zhaohaoran1997 avatar Apr 24 '19 03:04 Zhaohaoran1997

我甚至创建了一个新的用户来从头下载包运行程序,但是没变化

Zhaohaoran1997 avatar Apr 24 '19 03:04 Zhaohaoran1997

更换一个cache目录呢?

liuyijiang1994 avatar Apr 24 '19 09:04 liuyijiang1994

可能是我给数字化的标签加引号了,感觉这个错误在这里并不仅是模型错误触发的

Zhaohaoran1997 avatar Apr 25 '19 16:04 Zhaohaoran1997