transformers.js icon indicating copy to clipboard operation
transformers.js copied to clipboard

Transformers.js V4: Native WebGPU EP, repo restructuring, and more!

Open xenova opened this issue 3 months ago • 2 comments
trafficstars

This is the official, long-awaited PR that introduces Transformers.js V4. Although it's currently still in draft mode, I'll be posting updates here for early review!

  • [x] Migrate to and test new Native WebGPU EP.
    • Closes https://github.com/huggingface/transformers.js/issues/1435
    • Closes https://github.com/huggingface/transformers.js/issues/1424
    • Closes https://github.com/huggingface/transformers.js/issues/1418
    • Closes https://github.com/huggingface/transformers.js/issues/1416
    • Closes https://github.com/huggingface/transformers.js/issues/1320
    • Closes https://github.com/huggingface/transformers.js/issues/1309
    • Closes https://github.com/huggingface/transformers.js/issues/1307
    • Closes https://github.com/huggingface/transformers.js/issues/1308
    • Closes https://github.com/huggingface/transformers.js/issues/1217
  • [x] Upgrade ONNX Runtime versions
    • https://github.com/huggingface/transformers.js/issues/1403
  • [x] Move examples out of main transformers.js repo and into examples repo
  • [x] API fully backwards compatible with v3
  • [x] Migrate certain ONNX models on the HF hub to be v3 & v4 compatible (mainly focused on older models).
  • [ ] Auto-device detection and improved defaults, depending on the end-user’s resources.
  • [ ] Create an official Transformers.js Playground. This involves curating a list of recommended models for each task, as well as an interactive web-app/playground for users to explore what the library has to offer. We'd also like to add a simple copy-paste option for sample code so that users can get started much easier!
  • [ ] Upgrade default pipeline models
  • [ ] Migrate Tokenizer-specific logic (tokenizers.js and tests) to separate @huggingface/tokenizers library.
  • [ ] Complete conversion script overhaul. Introduces significant performance optimizations.
    • Closes https://github.com/huggingface/transformers.js/issues/1415
    • Closes https://github.com/huggingface/transformers.js/issues/1402
See benchmarks

https://huggingface.co/onnx-community/all-MiniLM-L6-v2-ONNX:

image

https://huggingface.co/onnx-community/bge-base-en-v1.5-ONNX:

image
  • [ ] Improved repository formatting & consistency
    • [ ] Organize modeling code into separate folders (./src/models/), grouped by model type -- models.js is getting pretty large!
    • [ ] Formatting will happen later to keep the number of changes between v3 and v4 lower.
  • [ ] Documentation improvements and updates (particularly for older models).
  • [ ] Fix typing issues
    • Closes https://github.com/huggingface/transformers.js/issues/1409
    • Closes https://github.com/huggingface/transformers.js/issues/1448
  • [ ] React native support
  • [ ] New models:
    • Chatterbox. Closes https://github.com/huggingface/transformers.js/issues/1434
    • Mamba/Mamba2 (e.g., Granite-4.0-h)

xenova avatar Jul 31 '25 03:07 xenova