transformers.js-examples  by huggingface

Collection of Transformers.js demos and example applications

Created 1 year ago
1,756 stars

Top 24.4% 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

3 weeks ago

Responsiveness

1 week

Pull Requests (30d)
3
Issues (30d)
2
Star History
48 stars in the last 30 days

Explore Similar Projects

Starred by Elvis Saravia Elvis Saravia(Founder of DAIR.AI), Tom Moor Tom Moor(Head of Engineering at Linear; Founder of Outline), and
5 more.

promptable by cfortuner

0%
2k
TS/JS library for building full-stack AI apps
Created 2 years ago
Updated 2 years ago
Starred by Jared Palmer Jared Palmer(Ex-VP AI at Vercel; Founder of Turborepo; Author of Formik, TSDX) and Andrew Kane Andrew Kane(Author of pgvector).

chatgpt-pgvector by gannonh

0%
938
Domain-specific chat completions app
Created 2 years ago
Updated 2 years ago
Feedback? Help us improve.