opendatalab/MinerU · error · FileNotFoundError

{model_path} does not exists.

Error message

{model_path} does not exists.

What it means

_verify_model checks the ONNX table-structure model path before loading: model_path must not be None (ValueError), must exist on disk (FileNotFoundError), and must be a regular file. The model file is normally auto-downloaded into the model root, so a missing file means the download step was skipped, failed, or the path is misconfigured.

Source

Thrown at mineru/model/table/rec/slanet_plus/table_structure_utils.py:106

    def get_character_list(self, key: str = "character") -> List[str]:
        meta_dict = self.session.get_modelmeta().custom_metadata_map
        return meta_dict[key].splitlines()

    def have_key(self, key: str = "character") -> bool:
        meta_dict = self.session.get_modelmeta().custom_metadata_map
        if key in meta_dict.keys():
            return True
        return False

    @staticmethod
    def _verify_model(model_path: Union[str, Path, None]):
        if model_path is None:
            raise ValueError("model_path is None!")

        model_path = Path(model_path)
        if not model_path.exists():
            raise FileNotFoundError(f"{model_path} does not exists.")

        if not model_path.is_file():
            raise FileExistsError(f"{model_path} is not a file.")


class ONNXRuntimeError(Exception):
    pass


class TableLabelDecode:
    def __init__(self, dict_character, merge_no_span_structure=True, **kwargs):
        if merge_no_span_structure:
            if "<td></td>" not in dict_character:
                dict_character.append("<td></td>")
            if "<td>" in dict_character:
                dict_character.remove("<td>")

        dict_character = self.add_special_char(dict_character)

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. Re-run the auto-download (or run once online) so the model lands in the configured model root.
  2. Verify the path: ls <model_root>/<model_file> and fix models_root / the passed model_path.
  3. If deploying offline, pre-copy the .onnx file into the image at the expected path.
  4. Check write permissions on the model root directory.

Example fix

# before
eng = TableRecognition(model_path='/opt/models/slanet.onnx')  # missing

# after
from mineru.utils.models_download_utils import auto_download_and_get_model_root_path
root = auto_download_and_get_model_root_path('slanet_plus')
eng = TableRecognition(model_path=Path(root) / 'slanet_plus.onnx')
Defensive patterns

Strategy: validation

Validate before calling

p = Path(model_path) if model_path else None
if p is None or not p.is_file():
    raise FileNotFoundError(f'run model download first; expected {p}')

Type guard

def is_valid_model_file(p) -> bool:
    return p is not None and Path(p).is_file()

Try / catch

try:
    eng = TableRecognition(model_path=p)
except FileNotFoundError as e:
    if 'does not exists' in str(e):
        auto_download_and_get_model_root_path('slanet_plus')  # fetch then retry once
        eng = TableRecognition(model_path=p)
    else:
        raise

Prevention

When it happens

Trigger: Constructing SLANet-plus table recognition with a custom model_path pointing at a nonexistent location, or when the auto-download of ModelPath.slane_plus failed (offline, no write permission, interrupted).

Common situations: Offline/air-gapped deployments where the model was never cached, models_root env var pointing to a read-only or wrong directory, typos in a user-supplied path.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/81ea7c34dfac2bd2. Report an issue: GitHub.