BadRequestError when loading a private model to space


while re-starting or rebooting my space I get a weird BadRequestError when a model from a private repo is supposed to be downloaded from the hub. There is a very similar topic Build Error - Bad Request that has been resolved a couple of days ago but the problem seems to persist in my situation.

I have no problem to execute my code and download the model locally.
Tried to restart/reboot the space a couple of times the last two weeks but without success.

Space: Deepdoctection - a Hugging Face Space by deepdoctection

This is the message I receive:

[0223 12:35.47] INF PyTorch version 1.9.0 available.
Traceback (most recent call last):
File “/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/”, line 213, in hf_raise_for_status
File “/home/user/.local/lib/python3.8/site-packages/requests/”, line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 43, in <module>
    layout_weights_path = dd.ModelDownloadManager.maybe_download_weights_and_configs(cfg.WEIGHTS.D2LAYOUT)
  File "/home/user/.local/lib/python3.8/site-packages/deepdoctection/extern/", line 795, in maybe_download_weights_and_configs
    ModelDownloadManager.load_model_from_hf_hub(profile, absolute_path_weights, file_names)
  File "/home/user/.local/lib/python3.8/site-packages/deepdoctection/extern/", line 822, in load_model_from_hf_hub
    size = ModelDownloadManager._load_from_hf_hub(repo_id, file_name, directory)
  File "/home/user/.local/lib/python3.8/site-packages/deepdoctection/extern/", line 861, in _load_from_hf_hub
    f_path = cached_download(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/", line 737, in cached_download
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/", line 479, in http_get
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/", line 250, in hf_raise_for_status
    raise BadRequestError(message, response=response) from e

Bad request:

Upgrading to huggingface_hub 0.12.0 resolved the problem.

Sorry for any inconvenience.

1 Like