Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Unreleased

* Updated the default llama.cpp native runtime pin to
`leehack/llamadart-native@v0.4.1-1`, keeping the `v0.4.1` llama.cpp
ABI/bindings while picking up wrapper-only native fixes. Refreshed
the `llamadart_llama_cpp_flutter` Apple SwiftPM checksum and
aligned current README/website native override docs.

- Extend the GGUF speech-to-text validation pack with four synthetic edge
fixtures built in-process, so no extra audio is stored: generated digital
silence, plus a truncated RIFF, a stereo 44.1 kHz re-encode and a 33-second
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Current default runtime pins:

| Runtime | Pin |
| --- | --- |
| Native llama.cpp / GGUF | `leehack/llamadart-native@v0.4.1` |
| Native llama.cpp / GGUF | `leehack/llamadart-native@v0.4.1-1` |
| Native LiteRT-LM / `.litertlm` | `leehack/litert-lm-native@v0.17.0-6` |
| Web llama.cpp / GGUF | `leehack/llama-web-bridge-assets@v0.1.44` |
| Web LiteRT-LM / `.litertlm` | `@litert-lm/core@0.15.0` |
Expand Down
138 changes: 83 additions & 55 deletions lib/src/backends/llama_cpp/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6298,6 +6298,15 @@ external int llama_dart_tts_api_version();
@ffi.Native<ffi.Void Function(ffi.Pointer<llama_dart_tts>)>()
external void llama_dart_tts_cancel(ffi.Pointer<llama_dart_tts> tts);

@ffi.Native<
ffi.Bool Function(ffi.Pointer<ggml_tensor>, ffi.Bool, ffi.Pointer<ffi.Void>)
>()
external bool llama_dart_tts_eval_callback(
ffi.Pointer<ggml_tensor> tensor,
bool ask,
ffi.Pointer<ffi.Void> user_data,
);

@ffi.Native<ffi.Void Function(ffi.Pointer<llama_dart_tts>)>()
external void llama_dart_tts_free(ffi.Pointer<llama_dart_tts> tts);

Expand Down Expand Up @@ -6403,6 +6412,23 @@ llama_dart_tts_status llama_dart_tts_reset(ffi.Pointer<llama_dart_tts> tts) {
return llama_dart_tts_status.fromValue(_llama_dart_tts_reset(tts));
}

@ffi.Native<
ffi.Int Function(ffi.Pointer<llama_dart_tts>, ffi.Pointer<ffi.Int8>)
>(symbol: 'llama_dart_tts_set_cancel_flag')
external int _llama_dart_tts_set_cancel_flag(
ffi.Pointer<llama_dart_tts> tts,
ffi.Pointer<ffi.Int8> flag,
);

llama_dart_tts_status llama_dart_tts_set_cancel_flag(
ffi.Pointer<llama_dart_tts> tts,
ffi.Pointer<ffi.Int8> flag,
) {
return llama_dart_tts_status.fromValue(
_llama_dart_tts_set_cancel_flag(tts, flag),
);
}

@ffi.Native<
ffi.Int Function(
ffi.Pointer<llama_dart_tts>,
Expand Down Expand Up @@ -8719,7 +8745,7 @@ external int mtmd_tokenize_from_parts(
bool add_special,
);

typedef FILE = __sFILE;
typedef FILE = _IO_FILE;

const int GGML_BACKEND_META_MAX_DEVICES = 16;

Expand Down Expand Up @@ -8858,88 +8884,90 @@ final class UnnamedUnion extends ffi.Union {
external ffi.Array<ffi.Char> val_str;
}

typedef __darwin_off_t = __int64_t;
typedef __int64_t = ffi.LongLong;
typedef Dart__int64_t = int;
final class _IO_FILE extends ffi.Struct {
@ffi.Int()
external int _flags;

final class __sFILE extends ffi.Struct {
external ffi.Pointer<ffi.UnsignedChar> _p;
external ffi.Pointer<ffi.Char> _IO_read_ptr;

@ffi.Int()
external int _r;
external ffi.Pointer<ffi.Char> _IO_read_end;

@ffi.Int()
external int _w;
external ffi.Pointer<ffi.Char> _IO_read_base;

@ffi.Short()
external int _flags;
external ffi.Pointer<ffi.Char> _IO_write_base;

@ffi.Short()
external int _file;
external ffi.Pointer<ffi.Char> _IO_write_ptr;

external __sbuf _bf;
external ffi.Pointer<ffi.Char> _IO_write_end;

@ffi.Int()
external int _lbfsize;
external ffi.Pointer<ffi.Char> _IO_buf_base;

external ffi.Pointer<ffi.Void> _cookie;
external ffi.Pointer<ffi.Char> _IO_buf_end;

external ffi.Pointer<
ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>
>
_close;
external ffi.Pointer<ffi.Char> _IO_save_base;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Int)
>
>
_read;
external ffi.Pointer<ffi.Char> _IO_backup_base;

external ffi.Pointer<
ffi.NativeFunction<fpos_t Function(ffi.Pointer<ffi.Void>, fpos_t, ffi.Int)>
>
_seek;
external ffi.Pointer<ffi.Char> _IO_save_end;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Int)
>
>
_write;
external ffi.Pointer<_IO_marker> _markers;

external __sbuf _ub;
external ffi.Pointer<_IO_FILE> _chain;

external ffi.Pointer<__sFILEX> _extra;
@ffi.Int()
external int _fileno;

@ffi.Int()
external int _ur;
external int _flags2;

@ffi.Array.multi([3])
external ffi.Array<ffi.UnsignedChar> _ubuf;
@__off_t()
external int _old_offset;

@ffi.Array.multi([1])
external ffi.Array<ffi.UnsignedChar> _nbuf;
@ffi.UnsignedShort()
external int _cur_column;

external __sbuf _lb;
@ffi.SignedChar()
external int _vtable_offset;

@ffi.Int()
external int _blksize;
@ffi.Array.multi([1])
external ffi.Array<ffi.Char> _shortbuf;

external ffi.Pointer<_IO_lock_t> _lock;

@fpos_t()
@__off64_t()
external int _offset;
}

final class __sFILEX extends ffi.Opaque {}
external ffi.Pointer<_IO_codecvt> _codecvt;

external ffi.Pointer<_IO_wide_data> _wide_data;

external ffi.Pointer<_IO_FILE> _freeres_list;

external ffi.Pointer<ffi.Void> _freeres_buf;

final class __sbuf extends ffi.Struct {
external ffi.Pointer<ffi.UnsignedChar> _base;
@ffi.Size()
external int __pad5;

@ffi.Int()
external int _size;
external int _mode;

@ffi.Array.multi([20])
external ffi.Array<ffi.Char> _unused2;
}

typedef fpos_t = __darwin_off_t;
final class _IO_codecvt extends ffi.Opaque {}

typedef _IO_lock_t = ffi.Void;
typedef Dart_IO_lock_t = void;

final class _IO_marker extends ffi.Opaque {}

final class _IO_wide_data extends ffi.Opaque {}

typedef __off64_t = ffi.Long;
typedef Dart__off64_t = int;
typedef __off_t = ffi.Long;
typedef Dart__off_t = int;
typedef ggml_abort_callback =
ffi.Pointer<ffi.NativeFunction<ggml_abort_callbackFunction>>;
typedef ggml_abort_callbackFunction =
Expand Down
2 changes: 1 addition & 1 deletion lib/src/hook/native_release_pins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
library;

/// `leehack/llamadart-native` release tag downloaded for the llama.cpp runtime.
const llamaCppTag = 'v0.4.1';
const llamaCppTag = 'v0.4.1-1';

/// `leehack/litert-lm-native` release tag downloaded for the LiteRT-LM runtime.
const liteRtLmReleaseTag = 'v0.17.0-6';
Expand Down
4 changes: 4 additions & 0 deletions packages/llamadart_llama_cpp_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Updated Apple SwiftPM native pin to `leehack/llamadart-native@v0.4.1-1`.

## 0.0.19

* Updated Apple SwiftPM native pin to `leehack/llamadart-native@v0.4.1`.
Expand Down
2 changes: 1 addition & 1 deletion packages/llamadart_llama_cpp_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies:
This package has no runtime Dart API of its own. Import `package:llamadart`
normally from the core package and use `LlamaBackend()` / `LlamaEngine` there.

The Apple SwiftPM manifest pins `leehack/llamadart-native@v0.4.1`.
The Apple SwiftPM manifest pins `leehack/llamadart-native@v0.4.1-1`.

Source for this package lives in
`packages/llamadart_llama_cpp_flutter` in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription

let packageRoot = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
let artifactsRoot = packageRoot.appendingPathComponent("Artifacts")
let llamaCppTag = "v0.4.1"
let llamaCppTag = "v0.4.1-1"

func localArtifactPath(_ name: String) -> String? {
let path = artifactsRoot.appendingPathComponent(name).path
Expand Down Expand Up @@ -47,7 +47,7 @@ let package = Package(
repository: "leehack/llamadart-native",
artifactName: "llamadart-native-apple-xcframework-\(llamaCppTag).zip",
tag: llamaCppTag,
checksum: "16175a4084a14af63cc66e78b9b2a8173d2e14db86775af280c859438bd8616a"
checksum: "bab353ce17dfbac9afe65ade73751d67f110b1807a1fb365b4d1df2db25a5418"
),
.target(
name: "llamadart_llama_cpp_flutter",
Expand Down
6 changes: 3 additions & 3 deletions website/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ hooks:
llamadart:
# Optional. Defaults to llamadart's tested native runtime pin.
# Use a leehack/llamadart-native release tag when testing another build.
llamadart_native_tag: v0.4.1
llamadart_native_tag: v0.4.1-1

# Optional. GitHub repository slug or github.com URL.
llamadart_native_repository: leehack/llamadart-native
Expand All @@ -115,7 +115,7 @@ per-target module list.
Native source overrides are for compatibility testing. They do not regenerate
Dart FFI bindings or symbol lookups, so the selected binary still must be ABI-
and symbol-compatible with the default
`leehack/llamadart-native@v0.4.1` runtime.
`leehack/llamadart-native@v0.4.1-1` runtime.

Available native tags are published on the
[`leehack/llamadart-native` releases page](https://github.com/leehack/llamadart-native/releases).
Expand Down Expand Up @@ -143,7 +143,7 @@ gh release list --repo leehack/llamadart-native --limit 20

Before overriding, confirm the release includes the asset for your target. The
hook downloads files named `llamadart-native-<bundle>-<tag>.tar.gz`, for example
`llamadart-native-windows-x64-v0.4.1.tar.gz`.
`llamadart-native-windows-x64-v0.4.1-1.tar.gz`.
For local testing, `llamadart_native_path` may point directly at a bundle
archive, at an extracted bundle directory, or at a directory containing
`<tag>/<bundle>/`, `<bundle>/`, or the expected archive file.
Expand Down
6 changes: 3 additions & 3 deletions website/docs/platforms/support-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ backend-module configuration for
`llamadart`.

The native-assets hook currently pins `llamadart-native` tag
`v0.4.1` and
`v0.4.1-1` and
`litert-lm-native` release `v0.17.0-6` (`lib/src/hook/native_release_pins.dart`). Apps can
override the llama.cpp native GitHub source with
`hooks.user_defines.llamadart.llamadart_native_tag` and
Expand Down Expand Up @@ -306,7 +306,7 @@ device/model bundle, use `cpu` or `gpu` for that artifact.
a web load failure as a package bug. The [WebGPU Bridge](./webgpu-bridge)
page has the browser-console probe and Flutter Web smoke-test path.

## Current llama.cpp module availability by bundle (`v0.4.1`)
## Current llama.cpp module availability by bundle (`v0.4.1-1`)

| Bundle key | Available backend modules in bundle |
| --- | --- |
Expand Down Expand Up @@ -354,7 +354,7 @@ hooks:
user_defines:
llamadart:
# Optional. Defaults to llamadart's tested native runtime pin.
llamadart_native_tag: v0.4.1
llamadart_native_tag: v0.4.1-1

# Optional. GitHub repository slug or github.com URL.
llamadart_native_repository: leehack/llamadart-native
Expand Down
Loading