llama_cpp_dart  by netdur

Dart bindings for llama.cpp

Created 1 year ago
253 stars

Top 99.4% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides Dart bindings for the llama.cpp C++ library, enabling developers to integrate advanced text generation capabilities into Dart and Flutter applications. It offers multiple levels of abstraction, from low-level FFI bindings for maximum control to a high-level, object-oriented API and a managed isolate for non-blocking Flutter integration, catering to a wide range of use cases and developer preferences.

How It Works

The library leverages Dart's Foreign Function Interface (FFI) to directly call functions within a compiled llama.cpp shared library. This allows for efficient execution of large language models. It abstracts these FFI calls into a simplified, object-oriented Dart API and further provides a managed isolate solution, which is ideal for Flutter applications, ensuring that model inference does not block the UI thread.

Quick Start & Requirements

  • Installation: Add llama_cpp_dart to your pubspec.yaml.
  • Prerequisites: Dart SDK or Flutter SDK, and a compiled llama.cpp shared library (.dylib, .so, or .dll). The llama.cpp repository must be cloned and compiled, ensuring support for your target hardware (CPU, Metal, CUDA, ROCm).
  • Setup: Building llama.cpp may take some time depending on the hardware and compilation options.
  • Documentation: Examples for low-level bindings, high-level wrappers, and managed isolates are available within the repository.

Highlighted Details

  • Supports multiple integration levels: low-level FFI, high-level wrapper, and managed isolate.
  • Provides flexibility in choosing model formats (e.g., Llama 2, ChatML, Gemma, Mistral) and quantization levels (e.g., F16, Q4_K_M).
  • Offers guidance on model selection based on use cases like text generation, embeddings, code generation, and multilingual support.

Maintenance & Community

The project is hosted on GitHub at netdur/llama_cpp_dart. Specific community links or contributor details are not explicitly mentioned in the README.

Licensing & Compatibility

The project is licensed under the MIT License, which permits commercial use and linking with closed-source applications.

Limitations & Caveats

The performance and quality of the LLM inference are dependent on the underlying llama.cpp library, the chosen model, quantization, and the user's hardware. The README does not detail specific performance benchmarks for the Dart bindings themselves.

Health Check
Last Commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
3
Star History
7 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Gabriel Almeida Gabriel Almeida(Cofounder of Langflow), and
2 more.

torchchat by pytorch

0.1%
4k
PyTorch-native SDK for local LLM inference across diverse platforms
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), Anil Dash Anil Dash(Former CEO of Glitch), and
23 more.

llamafile by Mozilla-Ocho

0.1%
23k
Single-file LLM distribution and runtime via `llama.cpp` and Cosmopolitan Libc
Created 2 years ago
Updated 2 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Vincent Weisser Vincent Weisser(Cofounder of Prime Intellect), and
7 more.

dalai by cocktailpeanut

0%
13k
Local LLM inference via CLI tool and Node.js API
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.