# huggingface\_hub.errors.HfHubHTTPError:

**URL:** <https://discuss.huggingface.co/t/huggingface-hub-errors-hfhubhttperror/136189>\
**Category:** Spaces\
**Created:** [January 17, 2025, 6:46am UTC](https://discuss.huggingface.co/t/huggingface-hub-errors-hfhubhttperror/136189 "2025-01-17T06:46:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jungrok](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jungrok](https://discuss.huggingface.co/u/jungrok)\
**Post date:** [January 17, 2025, 6:46am UTC](https://discuss.huggingface.co/t/huggingface-hub-errors-hfhubhttperror/136189/1 "2025-01-17T06:46:36Z")

</div>

I am trying to spacerunner with help of

`autotrain spacerunner --project-name demo5`

INFO | 2025-01-17 15:27:03 | autotrain.trainers.generic.utils:create\_dataset\_repo:23 - Creating dataset repo…  
INFO | 2025-01-17 15:27:04 | autotrain.trainers.generic.utils:create\_dataset\_repo:31 - Uploading dataset…

While pushing, it gives HTTP error :504

huggingface\_hub.errors.HfHubHTTPError: 504 Server Error: Gateway Time-out for url: [https://huggingface.co/api/datasets/jungrok/autotrain-demo5/commit/main](https://huggingface.co/api/datasets/jungrok/autotrain-demo5/commit/main)

What is the solution?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [January 17, 2025, 9:14am UTC](https://discuss.huggingface.co/t/huggingface-hub-errors-hfhubhttperror/136189/2 "2025-01-17T09:14:19Z")

</div>

It’s more likely to happen when the load is high, but uploading a model shouldn’t be that heavy, so I wonder if the server is acting up…  
It’s possible to avoid this by saving the pretrained model with ‘save\_pretrained’ instead of ‘push\_to\_hub’ and uploading it with git, etc., but you might need to raise an issue on github to get it resolved.

> <https://github.com/huggingface/huggingface_hub/issues/2460>
>
> \### Describe the bug
> 
> huggingface\_hub.utils.\_errors.HfHubHTTPError: 504 Server… Error: Gateway Time-out for url: https://huggingface.co/api/models?filter=text-classification&filter=pytorch&filter=transformers&sort=downloads&direction=-1&config=True&cursor=eyIkb3IiOlt7ImRvd25sb2FkcyI6MiwiX2lkIjp7IiRndCI6IjYzOTBkOWYzM2RlNzZkNjAyOTlhY2JlMCJ9fSx7ImRvd25sb2FkcyI6eyIkbHQiOjJ9fSx7ImRvd25sb2FkcyI6bnVsbH1dfQ%3D%3D
> 
> How to solve this?
> 
> \### Reproduction
> 
> I installed the latest version of \`huggingface\_hub\` but I faced 504 Gateway Timeout error.
> 
> \`\`\`
> \_huggingface\_api = HfApi()
> 
> def get\_models() -\> dict:
> pipeline\_tag = 'text-classification'
> applied\_tags = {
> 'pipelineTags': \[pipeline\_tag\],
> 'libraries': \['pytorch', 'transformers'\],
> }
> # TODO: Fix bug 504 Gateway Timeout
> models = \_huggingface\_api.list\_models(
> filter=\[tags for tags\_list in applied\_tags.values() for tags in tags\_list\],
> sort='downloads',
> direction=-1,
> fetch\_config=True
> )
> models = \[\_convert\_hf\_model\_info(model) for model in models if model.pipeline\_tag == pipeline\_tag\]
> ...
> \`\`\`
> 
> \### Logs
> 
> \_No response\_
> 
> \### System info
> 
> \`\`\`shell
> \- huggingface\_hub version: 0.25.0.dev0
> \- Platform: Linux-6.8.0-40-generic-x86\_64-with-glibc2.35
> \- Python version: 3.9.19
> \- Running in iPython ?: No
> \- Running in notebook ?: No
> \- Running in Google Colab ?: No
> \- Token path ?: /home/dummy/.cache/huggingface/token
> \- Has saved token ?: False
> \- Configured git credential helpers: 
> \- FastAI: N/A
> \- Tensorflow: N/A
> \- Torch: 1.13.1
> \- Jinja2: 3.1.2
> \- Graphviz: N/A
> \- keras: N/A
> \- Pydot: N/A
> \- Pillow: 10.3.0
> \- hf\_transfer: N/A
> \- gradio: N/A
> \- tensorboard: 2.6.2.2
> \- numpy: 1.22.0
> \- pydantic: 2.8.2
> \- aiohttp: 3.10.3
> \- ENDPOINT: https://huggingface.co
> \- HF\_HUB\_CACHE: /home/dummy/.cache/huggingface/hub
> \- HF\_ASSETS\_CACHE: /home/dummy/.cache/huggingface/assets
> \- HF\_TOKEN\_PATH: /home/dummy/.cache/huggingface/token
> \- HF\_HUB\_OFFLINE: False
> \- HF\_HUB\_DISABLE\_TELEMETRY: False
> \- HF\_HUB\_DISABLE\_PROGRESS\_BARS: None
> \- HF\_HUB\_DISABLE\_SYMLINKS\_WARNING: False
> \- HF\_HUB\_DISABLE\_EXPERIMENTAL\_WARNING: False
> \- HF\_HUB\_DISABLE\_IMPLICIT\_TOKEN: False
> \- HF\_HUB\_ENABLE\_HF\_TRANSFER: False
> \- HF\_HUB\_ETAG\_TIMEOUT: 10
> \- HF\_HUB\_DOWNLOAD\_TIMEOUT: 10
> 
> {'huggingface\_hub version': '0.25.0.dev0', 'Platform': 'Linux-6.8.0-40-generic-x86\_64-with-glibc2.35', 'Python version': '3.9.19', 'Running in iPython ?': 'No', 'Running in notebook ?': 'No', 'Running in Google Colab ?': 'No', 'Token path ?': '/home/dummy/.cache/huggingface/token', 'Has saved token ?': False, 'Configured git credential helpers': '', 'FastAI': 'N/A', 'Tensorflow': 'N/A', 'Torch': '1.13.1', 'Jinja2': '3.1.2', 'Graphviz': 'N/A', 'keras': 'N/A', 'Pydot': 'N/A', 'Pillow': '10.3.0', 'hf\_transfer': 'N/A', 'gradio': 'N/A', 'tensorboard': '2.6.2.2', 'numpy': '1.22.0', 'pydantic': '2.8.2', 'aiohttp': '3.10.3', 'ENDPOINT': 'https://huggingface.co', 'HF\_HUB\_CACHE': '/home/dummy/.cache/huggingface/hub', 'HF\_ASSETS\_CACHE': '/home/dummy/.cache/huggingface/assets', 'HF\_TOKEN\_PATH': '/home/dummy/.cache/huggingface/token', 'HF\_HUB\_OFFLINE': False, 'HF\_HUB\_DISABLE\_TELEMETRY': False, 'HF\_HUB\_DISABLE\_PROGRESS\_BARS': None, 'HF\_HUB\_DISABLE\_SYMLINKS\_WARNING': False, 'HF\_HUB\_DISABLE\_EXPERIMENTAL\_WARNING': False, 'HF\_HUB\_DISABLE\_IMPLICIT\_TOKEN': False, 'HF\_HUB\_ENABLE\_HF\_TRANSFER': False, 'HF\_HUB\_ETAG\_TIMEOUT': 10, 'HF\_HUB\_DOWNLOAD\_TIMEOUT': 10}
> \`\`\`
