Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements on Exposed ORT support #976

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

kallebysantos
Copy link
Contributor

Hey there 🙏,
Coming from #947, I did test the new Exposed ORT feature in alpha-v20 and alpha-21 releases. I'd notice that to make it work we must specify 'auto' as inference device:

Current behaviour:

Without specify a device:

import { pipeline } from '@huggingface/transformers';

let pipe = await pipeline('sentiment-analysis');
// The exposed runtime is loaded 
// but when trying to inference:
let out = await pipe('I love transformers!');
//Error: Unsupported device: "wasm". Should be one of: 

Explicit using auto as device:

import { pipeline } from '@huggingface/transformers';

let pipe = await pipeline('sentiment-analysis', null, { device: 'auto' });

let out = await pipe('I love transformers!');
// [{'label': 'POSITIVE', 'score': 0.999817686}]

To solve this annoying config, the PR improves the environment support for Exposed ORT by implicitly selecting 'auto' as the default fallback instead of 'wasm'.

import { pipeline } from '@huggingface/transformers';

let pipe = await pipeline('sentiment-analysis');

let out = await pipe('I love transformers!');
// [{'label': 'POSITIVE', 'score': 0.999817686}]

- Add global variable to check if `IS_EXPOSED_RUNTIME_ENV` -> true if Js
exposes their own custom runtime.
- Applying 'auto' device as default for exposed runtime environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant