Skip to content

Allow to choose ONNX Runtime in Electron App #1240

Open
@AdamStrojek

Description

@AdamStrojek

Feature request

It would be great to have the possibility to choose what ONNX Runtime is being used in Electron apps. Currently, the library is detecting Electron apps as Node.js. This generates a situation where the frontend of the application tries to use ORT for Node, which is CPU-only. It would be great to select which ORT would be used in case when detection fails.

In theory there is Electron example in repository, by it was built against 2.6 version
https://github.com/huggingface/transformers.js/blob/main/examples/electron/package.json#L18

Motivation

Giving possibility to change which ORT is used by, for example, an env variable, enables the possibility for the developer to decide which runtime is more suitable for the current situation when auto detection fails. This would allow the use of a more efficient method of calculations for models, for example, using WebGPU in the frontend of the application when still having access to fs and path modules and loading models directly from disk.

Your contribution

Unfortunately, my knowledge is limited to offer a whole PR, but I should be able to help in testing the solution and providing feedback and an example of how to use it. I already did initial changes on my own; unfortunately, I am still in the same spot where my Electron is not running correctly due to mixing Node and Web capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions