How to deal with OSError?

I pushed my finetuned model from Colab to HuggingFace.
But after creating .app file through gradio to test it I get the subject error.
Can anybody help me to figure it out what am I doing wrong, please?
Here is the full error:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/", line 239, 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: 404 Client Error: Not Found for url:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/transformers/utils/", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/", line 1067, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/", line 1376, in get_hf_file_metadata
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/", line 249, in hf_raise_for_status
    raise RevisionNotFoundError(message, response) from e
huggingface_hub.utils._errors.RevisionNotFoundError: 404 Client Error. (Request ID: GKBrTC838xDfOewwMjdUV)

Revision Not Found for url:
Invalid rev id: official

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 21, in <module>
    pretrained_model = DonutModel.from_pretrained("RustX/donut-base-finetuned-insurance")
  File "/home/user/.local/lib/python3.8/site-packages/donut/", line 593, in from_pretrained
    model = super(DonutModel, cls).from_pretrained(pretrained_model_name_or_path, revision="official", *model_args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/", line 2012, in from_pretrained
    config, model_kwargs = cls.config_class.from_pretrained(
  File "/home/user/.local/lib/python3.8/site-packages/transformers/", line 532, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/", line 559, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/transformers/", line 614, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/user/.local/lib/python3.8/site-packages/transformers/utils/", line 431, in cached_file
    raise EnvironmentError(
OSError: official is not a valid git identifier (branch name, tag name or commit id) that exists for this model name. Check the model page at '' for available revisions.

The model does not exist, error seems accurate.

Could you please look through the repo again. Yesterday I deleted to try in a different way but the error persists.

According to the error you are trying to resolve a file from a revision official that does not exist.

Only currently available revision on your model seems to be main ( does resolve successfully).

Next step would either be to change the revision you’re trying to load or publish a new revision of your model with the name official.

1 Like