huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.06k stars 543 forks source link

403 Client Error when pushing dataset to hub #1312

Closed ryan-caesar-ramos closed 1 year ago

ryan-caesar-ramos commented 1 year ago

Describe the bug

I was trying to push a dataset to the hub and kept getting the same error, caused by an HfHubHTTPError (403 Client Error). To be sure that it wasn't the specific dataset I was using that was causing the problem, I made a quick dummy dataset (seen in the repoduction code) and got the same errors.

Edit: Not sure if this is relevant, but the link shown here:

HfHubHTTPError: 403 Client Error: Forbidden for url: https://s3.us-east-1.amazonaws.com/lfs.huggingface.co/repos/d4/02/d402716d319c3088c67fa0d1e6d662869536acd4c9936a4fa2b1f1210c57f6df/fb2174de7a3e19959549523566a2b17dc48884b9f7e058afe5e823ae3caf7b8d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4N7VTDGO27GPWFUO%2F20230128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230128T133954Z&X-Amz-Expires=900&X-Amz-Signature=495e7042645b84584a952217f3b6d8624dfd447787ec627faf47a5720a272b22&X-Amz-SignedHeaders=host&x-amz-storage-class=INTELLIGENT_TIERING&x-id=PutObject

leads to this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<Error>
  <Code>SignatureDoesNotMatch</Code>
  <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
  <AWSAccessKeyId>AKIA4N7VTDGO27GPWFUO</AWSAccessKeyId>
  <StringToSign>AWS4-HMAC-SHA256 20230128T133954Z 20230128/us-east-1/s3/aws4_request 0a3e65c46bfd71693b3ac18aeea8683f19d420e33d03663763441ce84649aa10</StringToSign>
  <SignatureProvided>495e7042645b84584a952217f3b6d8624dfd447787ec627faf47a5720a272b22</SignatureProvided>
  <StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 33 30 31 32 38 54 31 33 33 39 35 34 5a 0a 32 30 32 33 30 31 32 38 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 30 61 33 65 36 35 63 34 36 62 66 64 37 31 36 39 33 62 33 61 63 31 38 61 65 65 61 38 36 38 33 66 31 39 64 34 32 30 65 33 33 64 30 33 36 36 33 37 36 33 34 34 31 63 65 38 34 36 34 39 61 61 31 30</StringToSignBytes>
  <CanonicalRequest>GET /lfs.huggingface.co/repos/d4/02/d402716d319c3088c67fa0d1e6d662869536acd4c9936a4fa2b1f1210c57f6df/fb2174de7a3e19959549523566a2b17dc48884b9f7e058afe5e823ae3caf7b8d X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4N7VTDGO27GPWFUO%2F20230128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230128T133954Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&x-amz-storage-class=INTELLIGENT_TIERING&x-id=PutObject host:s3.us-east-1.amazonaws.com host UNSIGNED-PAYLOAD</CanonicalRequest>
  <CanonicalRequestBytes>47 45 54 0a 2f 6c 66 73 2e 68 75 67 67 69 6e 67 66 61 63 65 2e 63 6f 2f 72 65 70 6f 73 2f 64 34 2f 30 32 2f 64 34 30 32 37 31 36 64 33 31 39 63 33 30 38 38 63 36 37 66 61 30 64 31 65 36 64 36 36 32 38 36 39 35 33 36 61 63 64 34 63 39 39 33 36 61 34 66 61 32 62 31 66 31 32 31 30 63 35 37 66 36 64 66 2f 66 62 32 31 37 34 64 65 37 61 33 65 31 39 39 35 39 35 34 39 35 32 33 35 36 36 61 32 62 31 37 64 63 34 38 38 38 34 62 39 66 37 65 30 35 38 61 66 65 35 65 38 32 33 61 65 33 63 61 66 37 62 38 64 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 6f 6e 74 65 6e 74 2d 53 68 61 32 35 36 3d 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 34 4e 37 56 54 44 47 4f 32 37 47 50 57 46 55 4f 25 32 46 32 30 32 33 30 31 32 38 25 32 46 75 73 2d 65 61 73 74 2d 31 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 32 33 30 31 32 38 54 31 33 33 39 35 34 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 39 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 68 6f 73 74 26 78 2d 61 6d 7a 2d 73 74 6f 72 61 67 65 2d 63 6c 61 73 73 3d 49 4e 54 45 4c 4c 49 47 45 4e 54 5f 54 49 45 52 49 4e 47 26 78 2d 69 64 3d 50 75 74 4f 62 6a 65 63 74 0a 68 6f 73 74 3a 73 33 2e 75 73 2d 65 61 73 74 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44</CanonicalRequestBytes>
  <RequestId>5YXQKS5BBB4SFYQD</RequestId>
  <HostId>qbvCc6LksEtiu2RuSZ1Wv7b18SdPag1aeRvoNbjVWNfTleP0zIhaTMcBXCB224MUdt0hL1farDk=</HostId>
</Error>

Reproduction

!pip install datasets

from huggingface_hub import notebook_login
from datasets import Dataset

notebook_login() # submit token first before running next line

Dataset.from_list([{'foo':0}, {'foo':1}]).push_to_hub('Ramos-Ramos/foo', private=True)

Logs

Pushing dataset shards to the dataset hub: 0%
0/1 [00:00<?, ?it/s]
Creating parquet from Arrow format: 100%
1/1 [00:00<00:00, 41.08ba/s]
Upload 1 LFS files: 0%
0/1 [00:00<?, ?it/s]
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    263     try:
--> 264         response.raise_for_status()
    265     except HTTPError as e:

24 frames
/usr/local/lib/python3.8/dist-packages/requests/models.py in raise_for_status(self)
    942         if http_error_msg:
--> 943             raise HTTPError(http_error_msg, response=self)
    944 

HTTPError: 403 Client Error: Forbidden for url: https://s3.us-east-1.amazonaws.com/lfs.huggingface.co/repos/d4/02/d402716d319c3088c67fa0d1e6d662869536acd4c9936a4fa2b1f1210c57f6df/fb2174de7a3e19959549523566a2b17dc48884b9f7e058afe5e823ae3caf7b8d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4N7VTDGO27GPWFUO%2F20230128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230128T133954Z&X-Amz-Expires=900&X-Amz-Signature=495e7042645b84584a952217f3b6d8624dfd447787ec627faf47a5720a272b22&X-Amz-SignedHeaders=host&x-amz-storage-class=INTELLIGENT_TIERING&x-id=PutObject

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

HfHubHTTPError                            Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/huggingface_hub/_commit_api.py in _inner_upload_lfs_object(batch_action)
    333             operation = oid2addop[batch_action["oid"]]
--> 334             return _upload_lfs_object(
    335                 operation=operation, lfs_batch_action=batch_action, token=token

/usr/local/lib/python3.8/dist-packages/huggingface_hub/_commit_api.py in _upload_lfs_object(operation, lfs_batch_action, token)
    390         logger.debug(f"Uploading {operation.path_in_repo} as LFS file...")
--> 391         lfs_upload(
    392             fileobj=fileobj,

/usr/local/lib/python3.8/dist-packages/huggingface_hub/lfs.py in lfs_upload(fileobj, upload_info, upload_action, verify_action, token)
    272     else:
--> 273         _upload_single_part(
    274             upload_url=upload_action["href"],

/usr/local/lib/python3.8/dist-packages/huggingface_hub/lfs.py in _upload_single_part(upload_url, fileobj)
    304     upload_res = http_backoff("PUT", upload_url, data=fileobj)
--> 305     hf_raise_for_status(upload_res)
    306     return upload_res

/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    317         # as well (request id and/or server error message)
--> 318         raise HfHubHTTPError(str(e), response=response) from e
    319 

HfHubHTTPError: 403 Client Error: Forbidden for url: https://s3.us-east-1.amazonaws.com/lfs.huggingface.co/repos/d4/02/d402716d319c3088c67fa0d1e6d662869536acd4c9936a4fa2b1f1210c57f6df/fb2174de7a3e19959549523566a2b17dc48884b9f7e058afe5e823ae3caf7b8d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4N7VTDGO27GPWFUO%2F20230128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230128T133954Z&X-Amz-Expires=900&X-Amz-Signature=495e7042645b84584a952217f3b6d8624dfd447787ec627faf47a5720a272b22&X-Amz-SignedHeaders=host&x-amz-storage-class=INTELLIGENT_TIERING&x-id=PutObject

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

RuntimeError                              Traceback (most recent call last)
<ipython-input-4-c952d8d64ec0> in <module>
----> 1 Dataset.from_list([{'foo':0}, {'foo':1}]).push_to_hub('Ramos-Ramos/foo')

/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py in push_to_hub(self, repo_id, split, private, token, branch, max_shard_size, num_shards, embed_external_files)
   4907             )
   4908 
-> 4909         repo_id, split, uploaded_size, dataset_nbytes, repo_files, deleted_size = self._push_parquet_shards_to_hub(
   4910             repo_id=repo_id,
   4911             split=split,

/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py in _push_parquet_shards_to_hub(self, repo_id, split, private, token, branch, max_shard_size, num_shards, embed_external_files)
   4802                 shard.to_parquet(buffer)
   4803                 uploaded_size += buffer.tell()
-> 4804                 _retry(
   4805                     api.upload_file,
   4806                     func_kwargs=dict(

/usr/local/lib/python3.8/dist-packages/datasets/utils/file_utils.py in _retry(func, func_args, func_kwargs, exceptions, status_codes, max_retries, base_wait_time, max_wait_time)
    279     while True:
    280         try:
--> 281             return func(*func_args, **func_kwargs)
    282         except exceptions as err:
    283             if retry >= max_retries or (status_codes and err.response.status_code not in status_codes):

/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs)
    122             )
    123 
--> 124         return fn(*args, **kwargs)
    125 
    126     return _inner_fn  # type: ignore

/usr/local/lib/python3.8/dist-packages/huggingface_hub/hf_api.py in upload_file(self, path_or_fileobj, path_in_repo, repo_id, token, repo_type, revision, commit_message, commit_description, create_pr, parent_commit)
   2535         )
   2536 
-> 2537         commit_info = self.create_commit(
   2538             repo_id=repo_id,
   2539             repo_type=repo_type,

/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs)
    122             )
    123 
--> 124         return fn(*args, **kwargs)
    125 
    126     return _inner_fn  # type: ignore

/usr/local/lib/python3.8/dist-packages/huggingface_hub/hf_api.py in create_commit(self, repo_id, operations, commit_message, commit_description, token, repo_type, revision, create_pr, num_threads, parent_commit)
   2344             raise
   2345 
-> 2346         upload_lfs_files(
   2347             additions=[
   2348                 addition

/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs)
    122             )
    123 
--> 124         return fn(*args, **kwargs)
    125 
    126     return _inner_fn  # type: ignore

/usr/local/lib/python3.8/dist-packages/huggingface_hub/_commit_api.py in upload_lfs_files(additions, repo_type, repo_id, token, endpoint, num_threads)
    344         f" {num_threads} threads concurrently"
    345     )
--> 346     thread_map(
    347         _inner_upload_lfs_object,
    348         filtered_actions,

/usr/local/lib/python3.8/dist-packages/tqdm/contrib/concurrent.py in thread_map(fn, *iterables, **tqdm_kwargs)
     92     """
     93     from concurrent.futures import ThreadPoolExecutor
---> 94     return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
     95 
     96 

/usr/local/lib/python3.8/dist-packages/tqdm/contrib/concurrent.py in _executor_map(PoolExecutor, fn, *iterables, **tqdm_kwargs)
     74             map_args.update(chunksize=chunksize)
     75         with PoolExecutor(**pool_kwargs) as ex:
---> 76             return list(tqdm_class(ex.map(fn, *iterables, **map_args), **kwargs))
     77 
     78 

/usr/local/lib/python3.8/dist-packages/tqdm/notebook.py in __iter__(self)
    257         try:
    258             it = super(tqdm_notebook, self).__iter__()
--> 259             for obj in it:
    260                 # return super(tqdm...) will not catch exception
    261                 yield obj

/usr/local/lib/python3.8/dist-packages/tqdm/std.py in __iter__(self)
   1193 
   1194         try:
-> 1195             for obj in iterable:
   1196                 yield obj
   1197                 # Update and possibly print the progressbar.

/usr/lib/python3.8/concurrent/futures/_base.py in result_iterator()
    617                     # Careful not to keep a reference to the popped future
    618                     if timeout is None:
--> 619                         yield fs.pop().result()
    620                     else:
    621                         yield fs.pop().result(end_time - time.monotonic())

/usr/lib/python3.8/concurrent/futures/_base.py in result(self, timeout)
    442                     raise CancelledError()
    443                 elif self._state == FINISHED:
--> 444                     return self.__get_result()
    445                 else:
    446                     raise TimeoutError()

/usr/lib/python3.8/concurrent/futures/_base.py in __get_result(self)
    387         if self._exception:
    388             try:
--> 389                 raise self._exception
    390             finally:
    391                 # Break a reference cycle with the exception in self._exception

/usr/lib/python3.8/concurrent/futures/thread.py in run(self)
     55 
     56         try:
---> 57             result = self.fn(*self.args, **self.kwargs)
     58         except BaseException as exc:
     59             self.future.set_exception(exc)

/usr/local/lib/python3.8/dist-packages/huggingface_hub/_commit_api.py in _inner_upload_lfs_object(batch_action)
    336             )
    337         except Exception as exc:
--> 338             raise RuntimeError(
    339                 f"Error while uploading '{operation.path_in_repo}' to the Hub."
    340             ) from exc

RuntimeError: Error while uploading 'data/train-00000-of-00001-6b24aee962daaf68.parquet' to the Hub.

System info

- huggingface_hub version: 0.12.0
- Platform: Linux-5.10.147+-x86_64-with-glibc2.29
- Python version: 3.8.10
- Running in iPython ?: Yes
- iPython shell: Shell
- Running in notebook ?: Yes
- Running in Google Colab ?: Yes
- Token path ?: /root/.cache/huggingface/token
- Has saved token ?: True
- Who am I ?: ryanramos
- Configured git credential helpers: store
- FastAI: 2.7.10
- Tensorflow: 2.9.2
- Torch: 1.13.1+cu116
- Jinja2: 2.11.3
- Graphviz: 0.10.1
- Pydot: 1.3.0
- Pillow: 7.1.2
- hf_transfer: N/A
- ENDPOINT: https://huggingface.co
- HUGGINGFACE_HUB_CACHE: /root/.cache/huggingface/hub
- HUGGINGFACE_ASSETS_CACHE: /root/.cache/huggingface/assets
- HF_HUB_OFFLINE: False
- HF_TOKEN_PATH: /root/.cache/huggingface/token
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
jslegers commented 1 year ago

Probably same issue as https://github.com/huggingface/huggingface_hub/issues/1311

radames commented 1 year ago

hi all, the issue is fixed on our hub backend. Please try your uploads again. Thanks

stevenbowler commented 1 year ago

related

HfHubHTTPError: 403 Client Error: Forbidden for url:

Forbidden: pass create_pr=1 as a query parameter to create a Pull Request

Wauplin commented 1 year ago

@stevenbowler not sure the issue is related. The issue above has the error HfHubHTTPError: 403 Client Error: Forbidden for url: https://s3.us-east-1.amazonaws.com/lfs.huggingface.co/repos/....... which is very different from your "403 forbidden please use create_pr=1". Could you open a new issue and had more details to it (packages version, script, stacktrace,...).

EDIT: one possibility for "Forbidden: pass create_pr=1 as a query parameter to create a Pull Request" is that you've tried to commit to a repo for which you don't have the permission. Please check you have access to the repo, generate a WRITE access token in your settings and run huggingfacecli login before re-running your script.

MDCurrent commented 1 year ago

still running into this

requests.exceptions.SSLError: (MaxRetryError("HTTPSConnectionPool(host='s3.us-east-1.amazonaws.com', port=443): 
Max retries exceeded with url: 
/lfs.huggingface.co/repos/be/ca/beca37002c5ac438409f93a19754e9f437f7ae2790d04373d0878d62c59bb311/8a79d873c505e259676694c3777558dda094e043cec78cc0c9dec74e69256885?
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4N7VTDGO27GPWFUO%2F20231018%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231018T142219Z&
X-Amz-Expires=86400&X-Amz-Signature=9990066d6d540bf5c230e4f259ca1c5e2336fbab53b81134a184455231e67ffb&X-Amz-SignedHeaders=host&partNumber=14&uploadId=pYuuv5cYTQxanvY_ZOdNBncUfiyVKLleaKHdfsC.fbKy9.fZj9KEdx373OzvbtBoERLdfDxG2P7VH.hpENb6kptfKkbn1KGDBPCQy3nyczadluCmYt68dWmpPHD99Y4x&x-id=UploadPart 
(Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)')))”), 
'(Request ID: c5cef6be-aa87-46ff-9cde-0a567ae513df)’)

with huggingface_hub v ’0.16.4’

not blocking any real dev work as i was just running https://github.com/huggingface/diffusers/tree/main/examples/controlnet

but wanted to raise it since this is closed

Wauplin commented 1 year ago

@MDCurrent The error you are reporting seems to be different. It looks like a transient ConnectionError while upload a file to the Hub right? Doesn't happen very often but if you encounter it again, would you mind opening a new issue and copy-paste the full stack-trace? It might help investigate further. Thanks in advance!

(also purely FYI, latest version is now 0.18.0 if you wanna update :rocket: :wink: )

alexbrowngh commented 10 months ago

Same issue here. I got the same error Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)'))) while uploading files to Huggingface Repo.

I am using WSL on Windows 11. I have tried all the following things but all failed with the same error:

  1. Use the web UI through Brave browser.
  2. Use Huggingface API in Python.
  3. Use git lfs to upload.

However, this issue seems to tie to a specific network. When I connected my Wifi to a different network, this error seems to disappear. That potentially problematic network has been working great and there is no firewall.

Wauplin commented 9 months ago

Same issue here. I got the same error Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)'))) while uploading files to Huggingface Repo.

I am using WSL on Windows 11. I have tried all the following things but all failed with the same error:

  1. Use the web UI through Brave browser.
  2. Use Huggingface API in Python.
  3. Use git lfs to upload.

However, this issue seems to tie to a specific network. When I connected my Wifi to a different network, this error seems to disappear. That potentially problematic network has been working great and there is no firewall.

Sorry you're facing this issue @alexbrowngh. Would you mind opening a new issue for it? And paste the full stacktrace to check when it happens? Also updating huggingface_hub to latest release (0.20.1) before trying and trying to use a minimal script that uploads a simple file. If you can reproduce the error in such a scenario, we might be able to investigate what wrong.

guo-chuanchuan commented 6 months ago

Same issue here. I got the same error Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)'))) while uploading files to Huggingface Repo. I am using WSL on Windows 11. I have tried all the following things but all failed with the same error:

  1. Use the web UI through Brave browser.
  2. Use Huggingface API in Python.
  3. Use git lfs to upload.

However, this issue seems to tie to a specific network. When I connected my Wifi to a different network, this error seems to disappear. That potentially problematic network has been working great and there is no firewall.

Sorry you're facing this issue @alexbrowngh. Would you mind opening a new issue for it? And paste the full stacktrace to check when it happens? Also updating huggingface_hub to latest release (0.20.1) before trying and trying to use a minimal script that uploads a simple file. If you can reproduce the error in such a scenario, we might be able to investigate what wrong.

同样的问题。我在上传文件到Huggingface Repo时遇到了同样的错误Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2426)')))。 我在Windows 11上使用WSL。我尝试了以下所有方法,但都失败了,并出现相同的错误:

  1. 通过Brave浏览器使用Web UI。
  2. 在Python中使用Huggingface API。
  3. 使用git lfs上传。

然而,这个问题似乎与一个特定的网络有关。当我将Wifi连接到不同的网络时,这个错误似乎消失了。这个潜在的问题网络一直工作得很好,没有防火墙。

很抱歉你面临这个问题@alexbrowngh。你介意为它开一期新杂志吗?然后粘贴完整的堆栈跟踪来检查它何时发生?在尝试使用上传简单文件的最小脚本之前,还将huggingface_hub更新到最新版本(0.20.1)。如果你能在这种情况下重现错误,我们也许就能调查出问题所在。

I need your help! ,I am sure:(1)token is write,(2)network is well.but run in WSL‘s Ubuntu has error: HTTPError Traceback (most recent call last) File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py:304, in hf_raise_for_status(response, endpoint_name) 303 try: --> 304 response.raise_for_status() 305 except HTTPError as e:

File ~/anaconda3/envs/torch_base/lib/python3.9/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: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create

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

HfHubHTTPError Traceback (most recent call last) File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/hf_api.py:3365, in HfApi.create_repo(self, repo_id, token, private, repo_type, exist_ok, space_sdk, space_hardware, space_storage, space_sleep_time, space_secrets, space_variables) 3364 try: -> 3365 hf_raise_for_status(r) 3366 except HTTPError as err:

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py:367, in hf_raise_for_status(response, endpoint_name) 361 message = ( 362 f"\n\n{response.status_code} Forbidden: {error_message}." 363 + f"\nCannot access content at: {response.url}." 364 + "\nIf you are trying to create or update content," 365 + "make sure you have a token with the write role." 366 ) --> 367 raise HfHubHTTPError(message, response=response) from e 369 # Convert HTTPError into a HfHubHTTPError to display request information 370 # as well (request id and/or server error message)

HfHubHTTPError: (Request ID: Root=1-66098c67-623a32fa7baef77772ebe4e9;c6b35efb-5559-4df5-a492-64422dfd065c)

403 Forbidden: You don't have the rights to create a model under the namespace "cc1314". Cannot access content at: https://huggingface.co/api/repos/create. If you are trying to create or update content,make sure you have a token with the write role.

During handling of the above exception, another exception occurred:

HTTPError Traceback (most recent call last) File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py:304, in hf_raise_for_status(response, endpoint_name) 303 try: --> 304 response.raise_for_status() 305 except HTTPError as e:

File ~/anaconda3/envs/torch_base/lib/python3.9/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/api/models/wav2vec2-large-xls-r-300m-turkish

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

RepositoryNotFoundError Traceback (most recent call last) Cell In[50], line 1 ----> 1 tokenizer.push_to_hub(repo_name)

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/transformers/utils/hub.py:873, in PushToHubMixin.push_to_hub(self, repo_id, use_temp_dir, commit_message, private, token, max_shard_size, create_pr, safe_serialization, revision, commit_description, tags, **deprecated_kwargs) 870 repo_url = deprecated_kwargs.pop("repo_url", None) 871 organization = deprecated_kwargs.pop("organization", None) --> 873 repo_id = self._create_repo( 874 repo_id, private=private, token=token, repo_url=repo_url, organization=organization 875 ) 877 # Create a new empty model card and eventually tag it 878 model_card = create_and_tag_model_card( 879 repo_id, tags, token=token, ignore_metadata_errors=ignore_metadata_errors 880 )

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/transformers/utils/hub.py:689, in PushToHubMixin._create_repo(self, repo_id, private, token, repo_url, organization) 686 repo_id = repo_id.split("/")[-1] 687 repo_id = f"{organization}/{repo_id}" --> 689 url = create_repo(repo_id=repo_id, token=token, private=private, exist_ok=True) 690 return url.repo_id

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py:119, in validate_hf_hub_args.._inner_fn(*args, *kwargs) 116 if check_use_auth_token: 117 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) --> 119 return fn(args, **kwargs)

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/hf_api.py:3373, in HfApi.create_repo(self, repo_id, token, private, repo_type, exist_ok, space_sdk, space_hardware, space_storage, space_sleep_time, space_secrets, space_variables) 3370 elif exist_ok and err.response.status_code == 403: 3371 # No write permission on the namespace but repo might already exist 3372 try: -> 3373 self.repo_info(repo_id=repo_id, repo_type=repo_type, token=token) 3374 if repo_type is None or repo_type == REPO_TYPE_MODEL: 3375 return RepoUrl(f"{self.endpoint}/{repo_id}")

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py:119, in validate_hf_hub_args.._inner_fn(*args, *kwargs) 116 if check_use_auth_token: 117 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) --> 119 return fn(args, **kwargs)

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/hf_api.py:2423, in HfApi.repo_info(self, repo_id, revision, repo_type, timeout, files_metadata, token) 2421 else: 2422 raise ValueError("Unsupported repo type.") -> 2423 return method( 2424 repo_id, 2425 revision=revision, 2426 token=token, 2427 timeout=timeout, 2428 files_metadata=files_metadata, 2429 )

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py:119, in validate_hf_hub_args.._inner_fn(*args, *kwargs) 116 if check_use_auth_token: 117 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) --> 119 return fn(args, **kwargs)

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/hf_api.py:2233, in HfApi.model_info(self, repo_id, revision, timeout, securityStatus, files_metadata, token) 2231 params["blobs"] = True 2232 r = get_session().get(path, headers=headers, timeout=timeout, params=params) -> 2233 hf_raise_for_status(r) 2234 data = r.json() 2235 return ModelInfo(**data)

File ~/anaconda3/envs/torch_base/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py:352, in hf_raise_for_status(response, endpoint_name) 333 elif error_code == "RepoNotFound" or ( 334 response.status_code == 401 335 and response.request is not None (...) 342 # => for now, we process them as RepoNotFound anyway. 343 # See https://gist.github.com/Wauplin/46c27ad266b15998ce56a6603796f0b9 344 message = ( 345 f"{response.status_code} Client Error." 346 + "\n\n" (...) 350 " make sure you are authenticated." 351 ) --> 352 raise RepositoryNotFoundError(message, response) from e 354 elif response.status_code == 400: 355 message = ( 356 f"\n\nBad request for {endpoint_name} endpoint:" if endpoint_name is not None else "\n\nBad request:" 357 )

RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-66098c68-768998ca118983fc3dc79054;53021a04-3237-49fd-8ada-ad99bb04eb7f)

Repository Not Found for url: https://huggingface.co/api/models/wav2vec2-large-xls-r-300m-turkish. Please make sure you specified the correct repo_id and repo_type. If you are trying to access a private or gated repo, make sure you are authenticated.