deep-rl-class icon indicating copy to clipboard operation
deep-rl-class copied to clipboard

[HANDS-ON BUG] Error pushing code to the hub

Open Sawaiz8 opened this issue 9 months ago • 0 comments

Describe the bug

I have been getting the following error message when I am pushing my model in unit2 handson on colab using push_to_hub function define in the notebook

HTTPError Traceback (most recent call last) /usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name) 405 try: --> 406 response.raise_for_status() 407 except HTTPError as e:

5 frames /usr/local/lib/python3.11/dist-packages/requests/models.py in raise_for_status(self) 1023 if http_error_msg: -> 1024 raise HTTPError(http_error_msg, response=self) 1025

HTTPError: 401 Client Error: Unauthorized 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) in <cell line: 0>() 1 username = "Sawaiz8" # FILL THIS 2 repo_name = "taxi-3-rl-course" # FILL THIS ----> 3 push_to_hub( 4 repo_id=f"{username}/{repo_name}", 5 model=model,

in push_to_hub(repo_id, model, env, video_fps, local_repo_path) 22 23 # Step 1: Create the repo ---> 24 repo_url = api.create_repo( 25 repo_id=repo_id, 26 exist_ok=True,

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs) 112 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) 113 --> 114 return fn(*args, **kwargs) 115 116 return _inner_fn # type: ignore

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_api.py in create_repo(self, repo_id, token, private, repo_type, exist_ok, resource_group_id, space_sdk, space_hardware, space_storage, space_sleep_time, space_secrets, space_variables) 3479 3480 try: -> 3481 hf_raise_for_status(r) 3482 except HTTPError as err: 3483 if exist_ok and err.response.status_code == 409:

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name) 475 # Convert HTTPError into a HfHubHTTPError to display request information 476 # as well (request id and/or server error message) --> 477 raise _format(HfHubHTTPError, str(e), response) from e 478 479

HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-67c43994-10dacebf2ca331944f8516aa;685babbf-1ec7-4dc1-9eb2-faeb436c4c50)

Invalid credentials in Authorization header


NOTE

I used the write token from my Hugging Face account and logged in using the notebook.login() command as mentioned in the hands-on guide.

Additionally, while installing the project dependencies, I encountered an error related to pickle5. I believe this issue arises because pickle5 requires Python versions between 3.7 and 3.8, which may not match the current environment.

Sawaiz8 avatar Mar 02 '25 11:03 Sawaiz8