xenova / transformers.js

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
https://huggingface.co/docs/transformers.js
Apache License 2.0
9.87k stars 582 forks source link

Is top-level await necessary in the v3 branch? #690

Closed ceynri closed 2 months ago

ceynri commented 2 months ago

Question

I saw the excellent performance of WebGPU, so I tried to install xenova/transformers.js#v3 as a dependency in my project.

I found that v3 uses the top-level await syntax. If I can't restrict users to using the latest browser version, I have to make it compatible (using vite-plugin-top-level-await or rollup-plugin-tla).

Is it possible to use other methods instead of top-level await? Or is this project not intended to support users who do not have support for top-level await?

Thanks.

xenova commented 2 months ago

I agree it's not super necessary, so I've updated the code to lazily check whether fp16 is available (which was the only reason top-level await was needed). :)

ceynri commented 2 months ago

@xenova Thanks for your rapid response! Looking forward to the official release of v3 coming soon! 😄🎉