transformers.js  by huggingface

Run Transformers models directly in your browser

Created 2 years ago
14,786 stars

Top 3.3% on SourcePulse

GitHubView on GitHub
Project Summary

This library enables state-of-the-art machine learning models to run directly in the browser using JavaScript, eliminating the need for server-side infrastructure. It targets web developers and researchers looking to integrate advanced NLP, computer vision, audio, and multimodal capabilities into client-side applications, offering a familiar API to the Hugging Face Python library.

How It Works

Transformers.js leverages ONNX Runtime for efficient execution of models within the browser. Models are converted to the ONNX format, a widely supported intermediate representation, using 🤗 Optimum. This approach allows for broad model compatibility and optimized performance, with support for both CPU (via WebAssembly) and GPU (via WebGPU) execution.

Quick Start & Requirements

Highlighted Details

  • Supports a wide range of tasks including text classification, object detection, speech recognition, and text-to-speech.
  • Offers GPU acceleration via WebGPU for improved performance.
  • Supports model quantization (e.g., q4, q8) for reduced bandwidth and faster inference in resource-constrained environments.
  • Provides a pipeline API mirroring the Python library for ease of use.

Maintenance & Community

  • Developed and maintained by Hugging Face.
  • Active community support through Hugging Face platforms.

Licensing & Compatibility

  • MIT License.
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

WebGPU is an experimental API and may have inconsistent support across browsers. Some advanced or less common model architectures might not yet be supported or require specific conversion steps.

Health Check
Last Commit

6 days ago

Responsiveness

1 day

Pull Requests (30d)
11
Issues (30d)
38
Star History
151 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), and
2 more.

towhee by towhee-io

0.0%
3k
Framework for neural data processing pipelines
Created 4 years ago
Updated 1 year ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Travis Fischer Travis Fischer(Founder of Agentic), and
2 more.

modelscope by modelscope

0.2%
8k
Model-as-a-Service library for model inference, training, and evaluation
Created 3 years ago
Updated 1 day ago
Feedback? Help us improve.