llama-cpp-wasm  by tangledgroup

Wasm build for llama.cpp

created 1 year ago
273 stars

Top 95.3% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides WebAssembly (Wasm) bindings for the llama.cpp library, enabling large language models (LLMs) to run directly in web browsers. It targets developers building client-side AI applications, offering a way to leverage LLMs without requiring server-side infrastructure, thus reducing latency and costs.

How It Works

The project compiles llama.cpp to WebAssembly, allowing it to execute within the browser's sandboxed environment. It utilizes Emscripten for the compilation process and provides JavaScript bindings to interact with the compiled C++ code. This approach enables efficient execution of LLM inference directly on the user's machine, leveraging WebAssembly's performance capabilities.

Quick Start & Requirements

  • Install/Run: Clone the repository, run ./build-single-thread.sh or ./build-multi-thread.sh. The compiled llama.cpp will be in dist/llama-st or dist/llama-mt.
  • Prerequisites: git, bash, make, cmake, clang, Node.js (for server example).
  • Demo: Online demos available at https://tangledgroup.github.io/llama-cpp-wasm/.
  • Example: Requires a local web server with SSL enabled (e.g., npx http-server -S -C cert.pem).

Highlighted Details

  • Supports both single-threaded and multi-threaded builds of llama.cpp.
  • Provides JavaScript classes (LlamaCpp) for easy integration into web applications.
  • Includes example JavaScript code demonstrating model loading, prompt submission, and output streaming.
  • Lists several compatible GGUF model URLs for quick testing.

Maintenance & Community

  • Supported by Tangled Group, Inc.
  • No explicit community links (Discord/Slack) or roadmap are provided in the README.

Licensing & Compatibility

  • The README does not explicitly state a license. llama.cpp itself is typically under the MIT license, but the specific licensing for this Wasm build and its bindings would need verification.
  • Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project appears to be a direct compilation of llama.cpp to Wasm, and performance will be heavily dependent on the user's hardware and browser capabilities. The README does not detail specific browser compatibility or performance benchmarks.

Health Check
Last commit

1 year ago

Responsiveness

Inactive

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

Explore Similar Projects

Feedback? Help us improve.