【解决方法】EOFError:Compressed file ended before the end-of-stream marker was reached

错误原因

文件下载中断后重新下载,或者文件已经下载完成,就会产生该错误。

解决办法

删除已经下载的文件,例如运行此代码时出错:
testset = datasets.FashionMNIST('~/.pytorch/F_MNIST_data/', download=True, train=False, transform=transform)

则在电脑中搜索“F_MNIST_data”,将该文件夹删除即可!
PS:若是MAC,直接快捷键:command + 空格,输入“~/.pytorch/F_MNIST_data/F_MNIST_data”就可以搜到。

猜你喜欢

转载自blog.csdn.net/weixin_45281949/article/details/103324284