Skip to content

Commit 2253efe

Browse files
authored
Merge pull request #21 from mcmah309/main
Fix To Allow Android To Work Out Of The Box
2 parents f2ad1e1 + b6386e3 commit 2253efe

File tree

3 files changed

+2960
-3780
lines changed

3 files changed

+2960
-3780
lines changed

lib/src/llama.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:convert';
22
import 'dart:ffi';
3+
import 'dart:io';
34
import 'dart:math';
45

56
import 'package:ffi/ffi.dart';
@@ -38,7 +39,7 @@ class Llama {
3839
int cursor = 0;
3940

4041
/// set llama.cpp library path
41-
static String? libraryPath;
42+
static String? libraryPath = Platform.isAndroid ? "libllama.so" : null;
4243

4344
/// Getter for the Llama library.
4445
///
@@ -76,7 +77,7 @@ class Llama {
7677
: modelParams = modelParams ?? ModelParams(),
7778
contextParams = contextParams ?? ContextParams(),
7879
samplingParams = samplingParams ?? SamplingParams() {
79-
lib.llama_backend_init(false);
80+
lib.llama_backend_init();
8081
llama_model_params modelParams = this.modelParams.get();
8182

8283
Pointer<Char> char = modelPath.toNativeUtf8().cast<Char>();

0 commit comments

Comments
 (0)