-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
platform:mobileissues related to ONNX Runtime mobile; typically submitted using templateissues related to ONNX Runtime mobile; typically submitted using templateplatform:webissues related to ONNX Runtime web; typically submitted using templateissues related to ONNX Runtime web; typically submitted using template
Description
Describe the issue
Environment
- React Native / Expo (standalone iOS build)
onnxruntime-react-native(version: 1.23.2)- Hermes
- Models bundled via Metro using
expo-asset
Problem
In the Expo dev client, loading a bundled model via
Asset.fromModule(...).localUri works.
In the standalone iOS build,
InferenceSession.create(localUri) fails when the model stays in the app bundle.
- The
localUriis afile://path inside the app bundle. - The session init fails with a generic “failed to load model” error.
- No model bytes are read unless we first copy the file out of the bundle.
Observed Behavior
InferenceSession.createrejects whenuripoints to the bundled file
(file://...in the app sandbox).- No clear error about:
- Path scheme
- Bundle accessibility
Workaround Applied
Copy the bundled model to a writable path before loading:
const dest =
FileSystem.documentDirectory + basename(asset.localUri);
await FileSystem.copyAsync({
from: asset.localUri,
to: dest,
});To reproduce
In an expo project with onnxruntime-react-native installed:
- Bundle a model (e.g.,
silero_vad_v5.onnx) viarequire(...). - Resolve with:
const asset = Asset.fromModule(mod);await asset.downloadAsync();const uri = asset.localUri;
- Call
InferenceSession.create(uri)(or the equivalent load API). - Observe failure in a standalone iOS build; the same code works in the Expo dev client.
Urgency
Not urgent, since workaround found.
Platform
iOS
OS Version
26
ONNX Runtime Installation
Released Package
Compiler Version (if 'Built from Source')
No response
Package Name (if 'Released Package')
onnxruntime-react-native
ONNX Runtime Version or Commit ID
1.23.2
ONNX Runtime API
Other / Unknown
Architecture
Other / Unknown
Execution Provider
Other / Unknown
Execution Provider Library Version
No response
Metadata
Metadata
Assignees
Labels
platform:mobileissues related to ONNX Runtime mobile; typically submitted using templateissues related to ONNX Runtime mobile; typically submitted using templateplatform:webissues related to ONNX Runtime web; typically submitted using templateissues related to ONNX Runtime web; typically submitted using template