mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
### Description
enable external data loading for ort-web.
### Why
The ORT external data design is highly depending on the file system,
especially synchronous file I/O APIs. Those are not available in web
platforms. We need to have extra code to make external data working on
web.
### How
Considering there is no file system in web, an implementation for web to
support external data is to use pre-loaded data. Assume model file
a.onnx includes initializers that linked to ./b.bin, we require users to
pass a full data file list when creating the session. The user code will
be look like:
```js
const mySess = await ort.InferenceSession.create('./path/model/a.onnx', {
// session options
externalData: [
{
// relative or absolute path/URL of the file,
// or a pre-loaded Uint8Array containing the data of the external data file
data: './path/data/b.bin',
// the relative path of the external data. Should match initializers' "location" value defined in the model file
path: './b.bin'
},
// { } if multiple external data file
]
});
```
Currently, this feature only works with JSEP build enabled.
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| browser-test-wasm-image-tensor-image.js | ||
| browser-test-wasm-multi-session-create.js | ||
| browser-test-wasm-no-threads.js | ||
| browser-test-wasm-path-override-filename.js | ||
| browser-test-wasm-path-override-prefix.js | ||
| browser-test-wasm-proxy-no-threads.js | ||
| browser-test-wasm-proxy.js | ||
| browser-test-wasm.js | ||
| browser-test-webgl.js | ||
| browser-test-webgpu-external-data.js | ||
| common.js | ||
| karma.conf.js | ||
| model.onnx | ||
| model_with_orig_ext_data.bin | ||
| model_with_orig_ext_data.onnx | ||
| node-test-main-no-threads.js | ||
| node-test-main.js | ||
| node-test-wasm-path-override-filename.js | ||
| node-test-wasm-path-override-prefix.js | ||
| package.json | ||
| run.js | ||
| simple-http-server.js | ||