transformers.js-examples  by huggingface

Collection of Transformers.js demos and example applications

created 11 months ago
1,687 stars

Top 25.7% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides a curated set of demonstrations and example applications for 🤗 Transformers.js, showcasing its capabilities in running large language models, image segmentation, and text embedding tasks directly within web browsers and Node.js environments. It targets developers looking to integrate advanced AI functionalities into client-side or server-side JavaScript applications without requiring Python or heavy backend infrastructure.

How It Works

The examples leverage Transformers.js, a JavaScript library that enables the execution of Hugging Face models directly in the browser or Node.js using WebAssembly and WebGPU. This approach allows for on-device inference, reducing latency and server costs, and enabling privacy-preserving AI applications. Models are converted to a JavaScript-compatible format, allowing them to run efficiently across various JavaScript runtimes.

Quick Start & Requirements

  • Many examples can be explored via interactive demos linked in the table.
  • For local development, cloning the repository and running npm install is typically required.
  • WebGPU examples necessitate a browser with WebGPU support and compatible hardware.
  • Node.js examples require a recent Node.js version.

Highlighted Details

  • Demonstrates advanced models like Phi-3.5 and Llama-3.2 running via WebGPU.
  • Includes image processing tasks such as segmentation and background removal using WebGPU.
  • Features semantic search and text embedding examples for Node.js, Bun, and Deno.
  • Provides integration examples for popular JavaScript frameworks like Next.js and SvelteKit.

Maintenance & Community

This repository is part of the Hugging Face ecosystem, a widely recognized hub for AI and machine learning.

Licensing & Compatibility

The repository itself is likely under a permissive license (e.g., MIT), aligning with the Hugging Face ecosystem's open-source philosophy. Specific model licenses within the examples may vary.

Limitations & Caveats

Performance for large models may be constrained by client-side hardware capabilities and browser limitations. WebGPU support is still evolving across different browsers and operating systems.

Health Check
Last commit

2 days ago

Responsiveness

1 week

Pull Requests (30d)
5
Issues (30d)
1
Star History
265 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.