Skip to main content
ToolPotion

Shumai

Shumai is a fast, differentiable tensor library for JavaScript and TypeScript, built with Bun and Flashlight. It enables software engineers and researchers to create datasets, train small models, and implement advanced training logic efficiently within the JavaScript ecosystem. It leverages native typed arrays and a JIT compiler for performance.

Description

Shumai is a differentiable tensor library designed for JavaScript and TypeScript, leveraging the speed of Bun and the power of Flashlight. It aims to make data manipulation, model training, and advanced inference logic more accessible and efficient for developers within the JavaScript ecosystem. By utilizing native typed arrays and Bun's Just-In-Time (JIT) compiler, Shumai offers a performant solution for tasks ranging from dataset creation to training small machine learning models.

The library provides core tensor operations, automatic differentiation for gradient computation, and seamless conversion to and from JavaScript native arrays. This allows developers to work with data directly in JavaScript, prepare it for GPU-compatible arrays, and then train models without leaving the environment. Shumai's architecture is built to minimize overhead, allowing JavaScript to get out of the way during training and inference, especially for smaller models.

Key capabilities include standard array utilities, tensor creation, mathematical operations, and gradient tracking. Users can enable gradient computation for tensors, perform operations, and then access the computed gradients. The library also offers features for memory management tuning, allowing users to adjust garbage collection parameters to optimize performance based on hardware capabilities. Furthermore, Shumai includes a statistics gathering system that can log operation performance to the console or over HTTP, with options for scoped profiling and stack trace collection.

Shumai is particularly beneficial for software engineers and researchers who are already working within the JavaScript ecosystem and want to incorporate machine learning capabilities without a steep learning curve associated with other languages or frameworks. Its performance benchmarks show significant advantages over libraries like TensorFlow.js in various operations, especially on Apple M1 Pro and Nvidia GPUs. The project is experimental, and contributions are welcomed to improve its functionality and stability.

Shumai's Core Features

  • Fast, differentiable tensor library for JavaScript and TypeScript

  • Built with Bun and Flashlight for high performance

  • Supports automatic differentiation for gradient computation

  • Seamless conversion between tensors and JavaScript native arrays

  • Optimized for training small models and advanced inference logic

  • Leverages native typed arrays and JIT compilation

  • Memory usage tuning for performance optimization

  • Built-in statistics gathering for operation profiling

  • Scoped statistics collection for isolated profiling

  • Experimental software with active development

  • Supports GPU computation via ArrayFire backends (CUDA on Linux, CPU on macOS)

  • Extensible statistics logging with Console and HTTP options

Getting Started with Shumai

  1. Install Bun and ArrayFire: Follow platform-specific instructions for macOS and Linux.

  2. Install Shumai: Run `bun install @shumai/shumai`.

  3. Import Shumai: Use `import * as sm from '@shumai/shumai'` in your TypeScript/JavaScript code.

  4. Create Tensors: Utilize functions like `sm.randn()` or `sm.tensor()` to create tensors.

  5. Perform Operations: Apply mathematical operations such as `matmul()`, `mul()`, and `sum()`.

  6. Enable Gradients: Set `tensor.requires_grad = true` for tensors that need gradient tracking.

  7. Compute Gradients: Call `.backward()` on the loss tensor to populate gradients.

  8. Tune Memory: Adjust memory options using `util.memoryOptions()` for performance.

Shumai's Use Cases

  • Dataset Creation
  • Model Training
  • Inference Logic
  • Data Preprocessing
  • Research Prototyping
  • Application Development

FAQ from Shumai

Shumai Reviews

Loading...

Popular AI Tools Like Shumai

AI Frameworks

TensorFlow is an end-to-end open source machine learning platform designed for everyone. It provides a flexible ecosystem of tools, libraries, and community resources to create…

FeaturedMachine Learning Platforms

Keras is an open-source deep learning library designed for humans. It simplifies the process of building neural networks and allows developers to contribute to its development on…

FeaturedMachine Learning Platforms

AI GitHub Repos

nanoGPT is a minimalist, high-performance GitHub repository for training and fine-tuning medium-sized GPT models. It offers a simple, readable codebase for researchers and…

FeaturedMachine Learning Platforms

🤗 Transformers is a model-definition framework designed for state-of-the-art machine learning models across text, vision, audio, and multimodal domains, facilitating both…

FeaturedMachine Learning Platforms

PyTorch is an open-source machine learning library that provides tools for building dynamic neural networks in Python, leveraging strong GPU acceleration for efficient computation.

FeaturedMachine Learning Platforms

Ray is an AI compute engine designed to accelerate machine learning workloads. It features a core distributed runtime and a set of AI libraries, making it suitable for various ML…

FeaturedMachine Learning Platforms

LocalAI is an open-source AI engine that allows users to run various models, including LLMs, vision, voice, image, and video, on any hardware without requiring a GPU. This…

FeaturedMachine Learning Platforms