Error 429
Author: milohpeng
Pull request: no

### System Info

transformers==4.25.1

Code block:

from transformers import AutoTokenizer, AutoModelForMaskedLM

tokenizer = AutoTokenizer.from_pretrained("flax-community/roberta-base-thai")
model = AutoModelForMaskedLM.from_pretrained("flax-community/roberta-base-thai")

Error:

OSError: There was a specific connection error when trying to load flax-community/roberta-base-thai:
429 Client Error: Too Many Requests for url: https://huggingface.co/flax-community/roberta-base-thai/resolve/main/config.json

### Who can help?

_No response_

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

Import package and run code. 

### Expected behavior

No errors expected.

Comments:
Hi, @milohpeng the script you gave seems to run fine on my side, maybe it was an issue regarding your internet connection, can you try now again and check if it runs or not? Or run `transformers-cli env` in terminal and give your system info so we can reproduce the error.

Here is the information as requested, 

- `transformers` version: 4.25.1
- Platform: Linux-5.4.56.bsk.10-amd64-x86_64-with-debian-10.12
- Python version: 3.7.3
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.11.0+cu102 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

I'm not sure whether my IP has been blacklisted...

@milohpeng I used the same environment as you and managed to get the results without any errors, maybe you tried to download the model so many times that they blacklisted your IP. 

I can't help you with this but maybe @sgugger can.

This should not consistently happen, as the error reflected (429) requires **a lot** of requests in a short amount of time. @milohpeng are you using a shared IP by any chance?

Hey @sgugger yes I am, I'm using my company's IP to access Huggingface. Is there anything I can do to reverse this as my colleagues seem to be affected as well? Thanks in advance! 

Could you provide us with the IP in question, so that I can investigate further with our infra team? You can email it to me (sylvain @ hf.co without the spaces) if you don't want it public. Thanks!

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

Hey @sgugger , I am encountering the same problem using different AWS SageMaker notebooks, since 24 hours.

IP address: `34.236.*.*` (happy to send you the full IP, e.g. via email - I tried your above email, but got a "Delivery Status Notification (Failure)")

Code to reproduce:
```python
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("gpt2") 

# above raises error:
# ...
# OSError: There was a specific connection error when trying to load gpt2:
# 429 Client Error: Too Many Requests for url: https://huggingface.co/gpt2/resolve/main/config.json
```

Anything I can do to overcome this problem? 

It happens even if I run the above code just once. Maybe AWS uses the same IP for a lot of notebooks..

Hi @trianxy, sadly @sgugger is no longer at HF so the email in this thread is no longer active. 

Pinging @philschmid who is the AWS Sagemaker master and will know more about this issue. 

@trianxy it seems like that the IP "spammed" the hub and you got rate limited. Did you ran some sort of loop to load stuff? The restriction should be lifted after 24h

Hey @philschmid , thanks for looking into this! 

No, I didn't run a loop. I probably ran it at most 3 times before the problem appeared.

Also, I don't think the IP is unique to me. I guess AWS uses it for a lot of customer notebooks.

Any chance having `34.*` IP addresses get a higher limit, since they seem to belong to AWS? 
Also, is there anything else I can do to overcome this, other than waiting? (also asking for when it happens again in the future)

let me share that internally. 

@trianxy can you send the full IP at api-enterprise@huggingface.co? cc @XciD 

> @trianxy can you send the full IP at [api-enterprise@huggingface.co](mailto:api-enterprise@huggingface.co)? cc @XciD

Yes, I just did.

Hi @trianxy,

Seems like the EC2 Ip you have was blacklisted in our waf. I've removed the restriction. Should be ready in a few minutes. 

Can you retry ?

Thanks @XciD , it works now!

Hello @philschmid, I am downloading the following dataset and after 20% of data was downloaded, I started getting the same error. How should I resolve it?
Thanks 

https://huggingface.co/datasets/cerebras/SlimPajama-627B 

`429 Client Error: Too Many Requests for url: [https://api-inference.huggingface.co/models](https://api-inference.huggingface.co/models/smart-panda314/dummy) `

I got the above error when I was trying to get tabular classification predictions from my own model 

I used the code below 
`from huggingface_hub import InferenceClient
input_data = [2, 3, 4, 2, 4]
df = pd.DataFrame([input_data], columns=cols_used)

client = InferenceClient()

table = df.to_dict(orient="records")

print(table)
client.tabular_classification(table=table, model=model_id)`

Can someone help me?

Hello, i am having the same problem using a HF llm
llm = HuggingFaceInferenceAPI(model_name="HuggingFaceH4/zephyr-7b-alpha", api_key='<HF_TOKEN>')
and recently i've been receiving this error : 
HfHubHTTPError: 429 Client Error: Too Many Requests for url: https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-alpha (Request ID: eEUYA-cnktBRdtG1e1zz9)

Rate limit reached. You reached free usage limit (reset hourly). Please subscribe to a plan at https://huggingface.co/pricing to use the API at this rate 

even with a new HF account i still get the same error : 
HfHubHTTPError: 429 Client Error: Too Many Requests for url: https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2 (Request ID: wlfNPgrEVuuH-lC_Mfgm4)

Rate limit reached. Please log in or use a HF access token 

Anyone can help with this ? 
Thanks in advance

@trianxy hey again, i hope that this message reaches you so that you may help me if you can so

Hey @asma-10 - I can't help you unfortunately, since I am not working at HF. You could try what I tried above (sending an email to [api-enterprise@huggingface.co](mailto:api-enterprise@huggingface.co))

@XciD I don't know what's going on, <Response [429]>
{'error': 'Rate limit reached. Please log in or use a HF access token'} appears in my terminal when I try to run the model and I already put my read and write access token, I didn't make many requests so I find it unlikely that I have reached the limit, I appreciate any help

![image](https://github.com/huggingface/transformers/assets/102836967/3d06a20d-d50e-47eb-97ed-622dee780f06)


facing the same problem here. help!

Hi @XciD,
I have the same problem. Could you help please? 

This still happens to me even though I set HF_HUB_OFFLINE=1.

@jxmorris12 in that case have pointed the model to corrected directory path, it should use that