Transformers.js v4 Preview: Now Available on NPM!
Blog post from HuggingFace
Transformers.js v4, now available as a preview on NPM, introduces several key improvements, including a new WebGPU runtime rewritten in C++ for better performance and support across JavaScript environments, allowing for state-of-the-art AI models to run locally in browsers and resource-constrained environments. The update also features a major restructuring of the codebase into a monorepo using pnpm workspaces, a modular class structure, and a standalone tokenization library, enhancing maintainability and ease of use. The build system has been switched from Webpack to esbuild, resulting in faster build times and smaller bundle sizes. Additionally, new models and architectures have been added, supporting advanced patterns and enabling hardware acceleration through WebGPU. The release also includes improved type safety, logging, and support for larger models, with acknowledgments to the ONNX Runtime team and contributors for their support in development.