shumai  by facebookresearch

Differentiable tensor library for TypeScript and JavaScript

created 3 years ago
1,160 stars

Top 34.1% on sourcepulse

GitHubView on GitHub
Project Summary

Shumai is a differentiable tensor library for JavaScript and TypeScript, leveraging Bun and the Flashlight C++ backend. It aims to provide high-performance tensor operations and automatic differentiation for developers and researchers working with machine learning models in a JavaScript environment.

How It Works

Shumai utilizes Bun's fast Foreign Function Interface (FFI) bindings to connect to the Flashlight C++ library, which is built on top of ArrayFire. This architecture allows it to execute computationally intensive tensor operations efficiently, either on the CPU or GPU (via ArrayFire's backends). The library supports automatic differentiation, enabling gradient computation for training neural networks.

Quick Start & Requirements

  • Install: bun install @shumai/shumai
  • Prerequisites: Bun, ArrayFire (CPU backend for macOS, CUDA backend for Linux recommended).
  • OS Support: macOS and Linux. Windows users can use Docker with WSL2.
  • Setup: Requires installing Bun and ArrayFire, which can involve compiling ArrayFire from source on some Linux configurations. See the official ArrayFire installation guide for details.

Highlighted Details

  • Achieves significant performance gains over TF.js on both Apple M1 Pro and Nvidia GP100 hardware for various tensor operations.
  • Offers flexible statistics collection, including console logging, HTTP endpoints for distributed tracing, and custom logger implementations.
  • Supports memory management tuning to optimize performance by controlling garbage collection behavior.
  • Allows for scoped statistics collection to profile specific code segments.

Maintenance & Community

The project is maintained by Facebook Research. Further community engagement details are not explicitly provided in the README.

Licensing & Compatibility

  • License: MIT
  • Compatibility: Permissive MIT license allows for commercial use and integration into closed-source projects.

Limitations & Caveats

This is experimental software. Installation can be complex, especially on Linux requiring manual ArrayFire builds. CPU computation relies on ArrayFire's CPU backend, which is noted as not well-optimized, with OpenCL support planned. Stack tracing for statistics collection incurs a significant performance overhead.

Health Check
Last commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
7 stars in the last 90 days

Explore Similar Projects

Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera) and Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

InternEvo by InternLM

1.0%
402
Lightweight training framework for model pre-training
created 1 year ago
updated 1 week ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), and
7 more.

ThunderKittens by HazyResearch

0.6%
3k
CUDA kernel framework for fast deep learning primitives
created 1 year ago
updated 3 days ago
Starred by George Hotz George Hotz(Author of tinygrad; Founder of the tiny corp, comma.ai), Anton Bukov Anton Bukov(Cofounder of 1inch Network), and
16 more.

tinygrad by tinygrad

0.1%
30k
Minimalist deep learning framework for education and exploration
created 4 years ago
updated 15 hours ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Nat Friedman Nat Friedman(Former CEO of GitHub), and
32 more.

llama.cpp by ggml-org

0.4%
84k
C/C++ library for local LLM inference
created 2 years ago
updated 10 hours ago
Feedback? Help us improve.