Skip to content

0.15.1

Choose a tag to compare

@decitre decitre released this 29 Nov 13:01
· 13 commits to main since this release

A fix for 0.15.0: a WASM load after a failed WebGPU run works again, and CameraCapture can switch between the cameras of a device. The two Voici apps were broken on some devices by their move to WebGPU in 0.15.0; they are fixed on the site.

Fixed

  • A failed WebGPU run no longer breaks a WASM load that comes after it. After a WebGPU run failed (for example Firefox 161 on macOS, where a shader does not compile for Metal), onnxruntime-web was left in a state where a session created afterwards, even a WASM one and even for another model, failed with the same error. After a WebGPU error in a task pipeline, the next load now imports a fresh copy of Transformers.js, whose onnxruntime-web starts clean. See #117 and #122.
    • This isolates the state only when onnxruntime-web is inside the Transformers.js file, as in the bundle a site serves itself (the lmLite apps). From jsDelivr it stays shared.
    • It covers task pipelines, not generation or OnnxModel.
    • It was tested with a simulated failure (a createComputePipeline that throws) in Pyodide and xeus-python; the real Firefox/Metal failure could not be run.
    • backend_fallback still covers only a load that fails. A run that fails, or that returns nothing, is not retried by the library: the apps do it themselves (below). A run-time fallback in the library is in #114.

New

  • CameraCapture.switch() and the device trait. switch() goes round the cameras the browser lists, one per call, opening each by its id; device names the camera in use (for example camera2 0, facing back). On a phone the list has every lens of the front and the rear camera, so it can take several calls to return to the first. A device with one camera says so in the widget and keeps it. Not meant while a request() is waiting.

Changed (the Voici apps, on the site, not in the package)

  • camera-objects and speak-french use WebGPU and swap to WASM when it fails. If a model that loaded on WebGPU fails to run, or returns nothing (no detection candidate at all, an empty transcript or translation), the app retries once on WASM and stays on WASM, and says so. The camera app showed this on a Galaxy S20 FE (Chrome, Adreno 6xx), where WebGPU returned nothing without an error. See #117, #121 and #124.
  • The apps show the backend and the inference time: (wasm after webgpu failed, 25.6 s) for the camera, and a line per model for the translator. A Debug checkbox adds the browser, the WebGPU adapter and limits, the fallback reason, the strongest scores and the photo size (camera), the heard text and the recording size (translator), and the camera in use. The camera app has a Switch camera button.

Docs

  • An ONNX Runtime badge in the README (#119), and switch() in the apps guide.

Notes

  • Slow on a phone. On a Galaxy S20 FE the camera app takes about 25 s per photo on WASM, and the first photo of a page load also pays the failed WebGPU attempt. See #126.
  • WebGPU output that is plausible but wrong is not caught. The apps check only for no output.
  • Not run: real Firefox with WebGPU (the failure was simulated), and the apps on any phone other than the Galaxy S20 FE.
  • Making WebGPU the default backend: #114. Making the apps installable and cached on a phone: #125.