ml-explore / mlx-data

Efficient framework-agnostic data loading
MIT License
362 stars 40 forks source link

HTTP Error 403 when trying to load mnist via load_mnist() in mlx.data.datasets #69

Closed menzHSE closed 3 months ago

menzHSE commented 3 months ago

I am getting the following HTTP error when trying to load MNIST. The URLs used by mlx-data (see https://github.com/fgnt/mnist) are accessible, e.g. https://raw.githubusercontent.com/fgnt/mnist/master/train-images-idx3-ubyte.gz.

$ python
Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:13:44) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mlx.data.datasets import load_mnist
>>> mnist = load_mnist()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/site-packages/mlx/data/datasets/mnist.py", line 67, in load_mnist
    download()
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/site-packages/mlx/data/datasets/mnist.py", line 42, in download
    urlretrieve_with_progress(base_url + name, out_file.name)
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/site-packages/mlx/data/datasets/common.py", line 77, in urlretrieve_with_progress
    request.urlretrieve(src, dst, reporthook=hook)
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 240, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
                            ^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 553, in error
    result = self._call_chain(*args)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 745, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/miniconda3/envs/mlx-202408/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
awni commented 3 months ago

We just haven't done a release in a while so the PyPi dist is still using "http://yann.lecun.com/exdb/mnist/". We should do a version bump and update the PyPi package at some point soon.

menzHSE commented 3 months ago

Thanks for clarifying! Will install from source then.