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/_errors.py", line 239, 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: 404 Client Error: Not Found for url: https://huggingface.co/RustX/donut-base-finetuned-insurance/resolve/official/config.json

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/hub.py", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1067, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1376, in get_hf_file_metadata
    hf_raise_for_status(r)
  File "/home/user/.local/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py", 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: https://huggingface.co/RustX/donut-base-finetuned-insurance/resolve/official/config.json.
Invalid rev id: official

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "app.py", line 21, in <module>
    pretrained_model = DonutModel.from_pretrained("RustX/donut-base-finetuned-insurance")
  File "/home/user/.local/lib/python3.8/site-packages/donut/model.py", 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/modeling_utils.py", line 2012, in from_pretrained
    config, model_kwargs = cls.config_class.from_pretrained(
  File "/home/user/.local/lib/python3.8/site-packages/transformers/configuration_utils.py", 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/configuration_utils.py", 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/configuration_utils.py", line 614, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/user/.local/lib/python3.8/site-packages/transformers/utils/hub.py", 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 'https://huggingface.co/RustX/donut-base-finetuned-insurance' 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 ( https://huggingface.co/RustX/donut-base-finetuned-insurance/resolve/main/config.json 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