Open
Description
実行環境
- OS:macOS Sonoma 14.4.1
- Python:3.12.3
- パッケージ管理:Poetry (version 1.8.2)
- 入っているライブラリ(
poetry show
の結果)
- contourpy 1.2.1
- cycler 0.12.1
- fonttools 4.51.0
- kiwisolver 1.4.5
- matplotlib 3.8.4
- numpy 1.26.4
- packaging 24.0
- pillow 10.3.0
- pyparsing 3.1.2
- python-dateutil 2.9.0.post0
- six 1.16.0
問題の事象
ch03/neuralnet_mnist.pyを実行したところ、以下のようにurllib.error.HTTPError: HTTP Error 403: Forbidden
というエラーが発生し、MNISTデータをダウンロードできない。
また、ブラウザからダウンロード先のリンクへアクセスしても403 Forbiddenとなっている。
Downloading train-images-idx3-ubyte.gz ...
Traceback (most recent call last):
File "/Users/takumi/github/deep-learning-from-scratch/ch03/neuralnet_mnist.py", line 35, in <module>
x, t = get_data()
^^^^^^^^^^
File "/Users/takumi/github/deep-learning-from-scratch/ch03/neuralnet_mnist.py", line 11, in get_data
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, flatten=True, one_hot_label=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 111, in load_mnist
init_mnist()
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 80, in init_mnist
download_mnist()
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 47, in download_mnist
_download(v)
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 40, in _download
response = urllib.request.urlopen(request).read()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
解決方法
- dataset/mnist.pyの13行目を以下のように変更する。
- 変更前
url_base = 'http://yann.lecun.com/exdb/mnist/'
- 変更後
url_base = 'https://storage.googleapis.com/cvdf-datasets/mnist/'
解決にあたって参考にしたもの
- https://github.com/cvdfoundation/mnist?tab=readme-ov-file#download
- READMEのTraining images, Training labels, Testing images , Testing labelsに張られたリンク先からダウンロードすればよい
@koki0702 お手数おかけしますが修正お願いいたします。
Metadata
Metadata
Assignees
Labels
No labels