【问题标题】:notMNIST not downloadable in TensorFlow Udacity coursenotMNIST 无法在 TensorFlow Udacity 课程中下载
【发布时间】: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


【解决方案1】:

也面临同样的情况。

处理它并继续是一件简单的事情。

大小不匹配。

只需使用 force=True 重新运行代码,然后 它现在可以工作了!

如果您尝试手动下载它也可以。

如本帖所述:https://github.com/tensorflow/tensorflow/issues/1475

希望对你有帮助。

【讨论】:

    【解决方案2】:

    我在 Udacity 论坛中找到了该问题的解决方案(解决方法?)。

    https://discussions.udacity.com/t/not-able-to-load-the-dataset-for-assingment-1/160124

    在页面中,提出了两种解决方案。

    一个。通过浏览器在本地下载notMNIST_large.tar.gz,使用docker命令复制。

    b.在获取脚本中添加“User-Agent”标头。

    我认为这两种方法都很好。

    【讨论】:

    • @h7r 如何使用 docker 命令复制它?我只是尝试复制粘贴,但它不起作用。
    猜你喜欢
    • 2023-03-27
    • 2016-05-12
    • 2019-09-15
    • 1970-01-01
    • 2015-12-15
    • 2021-09-01
    • 2017-01-28
    • 2018-11-14
    • 1970-01-01
    相关资源
    最近更新 更多