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

v3: fix bundler config for latest ORT #864

Merged
merged 9 commits into from
Aug 7, 2024

Conversation

fs-eire
Copy link

@fs-eire fs-eire commented Jul 25, 2024

This PR fixes bundler config for latest ORT.

After a few months' work, onnxruntime-web has finally stabilized its library export. There is not going to be big changes to this part in near future.

Discussion:

  • I disabled default wasm path override to CDN. Latest onnxruntime-web (ort.webgpu.bundle.min.js) allows bundler to pick the .wasm files by default, and this is verified locally for webpack and Vite(need a workaround for 'development' mode).
    • as mentioned above, the vite.config.js needs update. I only did that for segment-anything-client in this PR, but it may be necessary to update the config for all configuration in the code base.
    • transformerjs may offer users a choice of either using CDN or using self-hosted artifacts (by setting env.wasm.wasmPaths = undefined)

@fs-eire fs-eire changed the title fix bundler config for latest ORT v3: fix bundler config for latest ORT Jul 25, 2024
Comment on lines +46 to 52
module: {
parser: {
javascript: {
importMeta: false
}
}
},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required to preserve import.meta.url in the code. Otherwise webpack will replace the expression to a static string starting with "file://", which breaks worker/wasm loading.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@xenova xenova changed the base branch from v3 to @huggingface/transformers August 5, 2024 14:14
@xenova xenova merged commit 437cb34 into xenova:@huggingface/transformers Aug 7, 2024
@xenova
Copy link
Owner

xenova commented Aug 7, 2024

Thanks! Merged into @huggingface/transformers branch 👍

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.

2 participants