EntryNotFoundError when downloading from REDACTED_TOKEN_url
While stepping through the tutorial onSemantic SegmentationI got a EntryNotFoundError when I tried to download from the Hub.Code usedimport json
from huggingface_hub import cached_download, REDACTED_TOKEN_url
repo_id = "huggingface/label-files"
filename = "ade20k-hf-doc-builder.json"
id2label = json.load(open(cached_download(REDACTED_TOKEN_url(repo_id, filename, repo_type="dataset")), "r"))
id2label = {int(k): v for k, v in id2label.items()}
label2id = {v: k for k, v in id2label.items()}
num_labels = len(id2label)Error message---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File /hdd/Python3810/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py:261, in REDACTED_TOKEN_for_status(response, endpoint_name)
    260 try:
--> 261     response.raise_for_status()
    262 except HTTPError as e:

File /hdd/Python3810/lib/python3.8/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/datasets/huggingface/label-files/resolve/main/ade20k-hf-doc-builder.json

The above exception was the direct cause of the following exception:

EntryNotFoundError                        Traceback (most recent call last)
Cell In[29], line 9
      5 repo_id = "huggingface/label-files"
      7 filename = "ade20k-hf-doc-builder.json"
----> 9 id2label = json.load(open(cached_download(REDACTED_TOKEN_url(repo_id, filename, repo_type="dataset")), "r"))
     11 id2label = {int(k): v for k, v in id2label.items()}
     13 label2id = {v: k for k, v in id2label.items()}

File /hdd/Python3810/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py:118, in validate_REDACTED_TOKEN_args.<locals>._inner_fn(*args, **kwargs)
    115 if check_use_auth_token:
    116     kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> 118 return fn(*args, **kwargs)

File /hdd/Python3810/lib/python3.8/site-packages/huggingface_hub/file_download.py:689, in cached_download(url, library_name, library_version, cache_dir, user_agent, force_download, force_filename, proxies, etag_timeout, resume_download, token, local_files_only, legacy_cache_layout)
    679 r = _request_wrapper(
    680     method="HEAD",
    681     url=url,
   (...)
    686     timeout=etag_timeout,
    687 )
    688 headers.pop("Accept-Encoding", None)
--> 689 REDACTED_TOKEN_for_status(r)
    690 etag = r.headers.get(HUGGINGFACE_HEADER_X_LINKED_ETAG) or r.headers.get("ETag")
    691 # We favor a custom header indicating the etag of the linked resource, and
    692 # we fallback to the regular etag header.
    693 # If we don't have any of those, raise an error.

File /hdd/Python3810/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py:271, in REDACTED_TOKEN_for_status(response, endpoint_name)
    269 elif error_code == "EntryNotFound":
    270     message = f"{response.status_code} Client Error." + "\n\n" + f"Entry Not Found for url: {response.url}."
--> 271     raise EntryNotFoundError(message, response) from e
    273 elif error_code == "GatedRepo":
    274     message = (
    275         f"{response.status_code} Client Error." + "\n\n" + f"Cannot access gated repo for url {response.url}."
    276     )

EntryNotFoundError: 404 Client Error. (Request ID: Root=1-64d966a5-0119207d3ced2d0c25043d66;7b19ebea-b8a9-435a-9a68-68631b13f934)

Entry Not Found for url: https://huggingface.co/datasets/huggingface/label-files/resolve/main/ade20k-hf-doc-builder.json.Can someone help me to resolve this?
2023-09-06T21:37:30Z
I ran into the same issue, use this file name:ade20k-id2label.json. Found this in the repo athttps://huggingface.co/datasets/huggingface/label-files/blob/main/ade20k-id2label.json
2023-09-07T06:49:44Z
As you can seehere, the file you are looking for is not available in that repository.