Skip to content

onnxruntime 1.24 broke loading models from the huggingface_hub cache #27353

@istupakov

Description

@istupakov

Describe the issue

HuggingFace is the most popular method for distributing models. When downloaded through the official huggingface_hub package, it saves them to a cache. The snapshot_download function returns a folder with symlinks to the actual blobs.

onnxruntime 1.24 prohibits (#26776) the use of symlinks for data files, which completely breaks the loading of large models from the huggingface_hub cache.

To reproduce

Code

!uv pip install huggingface_hub "onnxruntime==1.24.1"

from pathlib import Path
from huggingface_hub import snapshot_download
import onnxruntime as rt

model_folder = snapshot_download("istupakov/parakeet-tdt-0.6b-v3-onnx")
rt.InferenceSession(Path(model_folder) / "encoder-model.onnx")

Gives an error:

Fail: [ONNXRuntimeError] : 1 : FAIL : External data path validation failed for initializer: pre_encode.out.bias. Error: tensorprotoutils.cc:346 ValidateExternalDataPath External data path: "encoder-model.onnx.data" escapes model directory: "/root/.cache/huggingface/hub/models--istupakov--parakeet-tdt-0.6b-v3-onnx/snapshots/abd2878d52a678ce380088ef9d9b1d9664404565"

Urgency

This issue completely broke my onnx-asr project (and probably many others using huggingface_hub) running on onnxruntime 1.24.

Platform

Linux

OS Version

Any

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.24.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions