question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to download a particular public model due to Forbidden connection error

See original GitHub issue

To reproduce:

!pip install transformers flax

from transformers import FlaxBertForSequenceClassification 

# Works Fine
model = FlaxBertForSequenceClassification.from_pretrained("Jeevesh8/bert-base-uncased_ft_13")

# Does not work
model = FlaxBertForSequenceClassification.from_pretrained("Jeevesh8/bert-base-uncased_ft_13")

Url for the models: model-13 , model-12 .

The stack trace is shown below:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/transformers/modeling_flax_utils.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, dtype, *model_args, **kwargs)
    492                     use_auth_token=use_auth_token,
--> 493                     user_agent=user_agent,
    494                 )

6 frames
[/usr/local/lib/python3.7/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in cached_path(url_or_filename, cache_dir, force_download, proxies, resume_download, user_agent, extract_compressed_file, force_extract, use_auth_token, local_files_only)
    289             use_auth_token=use_auth_token,
--> 290             local_files_only=local_files_only,
    291         )

[/usr/local/lib/python3.7/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in get_from_cache(url, cache_dir, force_download, proxies, etag_timeout, resume_download, user_agent, use_auth_token, local_files_only)
    584 
--> 585             http_get(url_to_download, temp_file, proxies=proxies, resume_size=resume_size, headers=headers)
    586 

[/usr/local/lib/python3.7/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in http_get(url, temp_file, proxies, resume_size, headers)
    423     r = requests.get(url, stream=True, proxies=proxies, headers=headers)
--> 424     _raise_for_status(r)
    425     content_length = r.headers.get("Content-Length")

[/usr/local/lib/python3.7/dist-packages/transformers/utils/hub.py](https://localhost:8080/#) in _raise_for_status(request)
    412 
--> 413     request.raise_for_status()
    414 

[/usr/local/lib/python3.7/dist-packages/requests/models.py](https://localhost:8080/#) in raise_for_status(self)
    940         if http_error_msg:
--> 941             raise HTTPError(http_error_msg, response=self)
    942 

HTTPError: 403 Client Error: Forbidden for url: https://cdn-lfs.huggingface.co/repos/d3/1e/d31eb036ce6c4a7575c86e3dee7417d780d3ed0dc49354c02a341db0cb3bcf36/d7e7bc2829aa424f798c3d3d14fe424eb2c9ed11079dd27394591e6a0ac9548b

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
[<ipython-input-17-c6d73358c86e>](https://localhost:8080/#) in <module>()
      1 from transformers import FlaxBertForSequenceClassification
----> 2 model = FlaxBertForSequenceClassification.from_pretrained("Jeevesh8/bert-base-uncased_ft_13")

[/usr/local/lib/python3.7/dist-packages/transformers/modeling_flax_utils.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, dtype, *model_args, **kwargs)
    527             except HTTPError as err:
    528                 raise EnvironmentError(
--> 529                     f"There was a specific connection error when trying to load {pretrained_model_name_or_path}:\n"
    530                     f"{err}"
    531                 )

OSError: There was a specific connection error when trying to load Jeevesh8/bert-base-uncased_ft_13:
403 Client Error: Forbidden for url: https://cdn-lfs.huggingface.co/repos/d3/1e/d31eb036ce6c4a7575c86e3dee7417d780d3ed0dc49354c02a341db0cb3bcf36/d7e7bc2829aa424f798c3d3d14fe424eb2c9ed11079dd27394591e6a0ac9548b

I don’t understand what’s the problem here?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
coyotte508commented, May 6, 2022

The particular LFS object is not present on the bucket. It is likely that it was not uploaded correctly.

0reactions
Jeevesh8commented, May 7, 2022

I deleted the repository, created a new repository by the same name, and did git push -f origin main in my local repository. It still shows the same error. I am able to load the model from my local repository, though.

Could be some git-lfs error. Should I close this issue for now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

403 Forbidden Error - What Is It and How to Fix It
The 403 Forbidden error usually occurs due to access misconfiguration. The misconfiguration involves improper read, write, or execute permission ...
Read more >
Fix file download errors - Google Chrome Help
This error means you don't have permission to download this file from the server. To fix it, go to the website where the...
Read more >
What Is the 403 Forbidden Error and How to Fix It (8 Methods ...
Can't access a website due to the 403 Forbidden error? ... error when you visit an empty website directory or a specific page...
Read more >
403 Forbidden Error: What It Is and How to Fix It - Airbrake Blog
The server network object is producing the 403 Error and returning it as the HTTP response code to the client. On the other...
Read more >
Getting 403 forbidden from s3 when attempting to download a ...
The problem here stems from how you get the files into the bucket. Specifically the credentials you have and/or privileges you grant at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found