【发布时间】:2016-02-10 16:03:53
【问题描述】:
我正在学习 Udacity TensorFlow 课程,第一个练习:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/1_notmnist.ipynb
OSX 10.11 (El Capitan) 蟒蛇 2.7 TF的virtualenv安装
我收到一个错误:
“异常:无法验证notMNIST_large.tar.gz。你可以用浏览器访问它吗?”
它会找到“小”文件,但不会找到“大”文件。感谢帮助。谢谢。
这是整个代码块:
>>> url = 'http://yaroslavvb.com/upload/notMNIST/'
>>>
>>> def maybe_download(filename, expected_bytes):
... """Download a file if not present, and make sure it's the right size."""
... if not os.path.exists(filename):
... filename, _ = urlretrieve(url + filename, filename)
... statinfo = os.stat(filename)
... if statinfo.st_size == expected_bytes:
... print('Found and verified', filename)
... else:
... raise Exception(
... 'Failed to verify' + filename + '. Can you get to it with a browser?')
... return filename
...
这是返回的内容:
>>> train_filename = maybe_download('notMNIST_large.tar.gz', 247336696)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 10, in maybe_download
Exception: Failed to verifynotMNIST_large.tar.gz. Can you get to it with a browser?
>>> test_filename = maybe_download('notMNIST_small.tar.gz', 8458043)
Found and verified notMNIST_small.tar.gz
【问题讨论】:
-
您的代码专门测试下载的大小并将其与预先确定的文件大小进行比较。如果大小不匹配,则会引发异常。检查下载文件的大小(手动)并重新验证您期望的大小。
-
你能解决这个问题吗?
-
是的,我能够让它工作。
标签: python tensorflow