BadRequestError when loading a private model to space

Hi,

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 @file_utils.py:33] INF PyTorch version 1.9.0 available.
Traceback (most recent call last):
File “/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py”, line 213, in hf_raise_for_status
response.raise_for_status()
File “/home/user/.local/lib/python3.8/site-packages/requests/models.py”, 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 "app.py", 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/model.py", 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/model.py", 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/model.py", line 861, in _load_from_hf_hub
    f_path = cached_download(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 737, in cached_download
    http_get(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 479, in http_get
    hf_raise_for_status(r)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py", line 250, in hf_raise_for_status
    raise BadRequestError(message, response=response) from e
huggingface_hub.utils._errors.BadRequestError: 

Bad request:

Upgrading to huggingface_hub 0.12.0 resolved the problem.

Sorry for any inconvenience.

1 Like