Open6

Flutter ローカルLLM

hndrhndr

llama.cpp

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp

Build MacOS

mkdir build
cd build
cmake ..
make

Build iOS (Metal)

mkdir build-metal
cd build-metal
cmake -DLLAMA_METAL=ON ..
cmake --build . --config Release
cd ..

Build Android

mkdir build-android
cd build-android
export NDK=<your_ndk_directory>
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod ..
make

https://medium.com/@nicosnicolaou/ndk-setup-on-android-flutter-android-project-1571d9a3f5cb

https://github.com/ggerganov/llama.cpp

flutter アプリ作成

flutter create flutter_llm_sample
cd flutter_llm_sample

ffi install

flutter pub add ffi

https://pub.dev/packages/ffi
https://qiita.com/hyshu/items/8eb71d7d36d56b2b5bb0
https://zenn.dev/turing_motors/articles/c62030a38d2eda

llama_cpp_dart install

flutter pub add llama_cpp_dart

https://pub.dev/packages/llama_cpp_dart
https://github.com/netdur/llama_cpp_dart

Package / repository

https://pub.dev/packages/llama_cpp
https://github.com/MidstallSoftware/flutter_llama
https://github.com/Telosnex/fllama
https://pyimagesearch.com/2024/08/26/llama-cpp-the-ultimate-guide-to-efficient-llm-inference-and-applications/
https://flutterawesome.com/a-mobile-implementation-of-llama-cpp/
https://github.com/Bip-Rep/sherpa
https://youtu.be/lDn-Qr80_Ec?si=9lqzqBEI9ICZE2un
https://github.com/Mobile-Artificial-Intelligence/maid
https://github.com/paulocoutinhox/llama-flutter
https://github.com/Mobile-Artificial-Intelligence/maid

hndrhndr

https://github.com/netdur/llama_cpp_dart/issues/28

ios/.symlinks/plugins/llama_cpp_dart/ios/llama_cpp_dart.podspec

Pod::Spec.new do |s|
  s.name             = 'llama_cpp_dart'
  s.version          = '0.0.1'
  s.summary          = 'Llama Cpp Dart'
  s.homepage         = 'https://github.com/netdur/llama_cpp_dart'
  s.license          = { :type => 'MIT' }
  s.author           = { 'netdur' => 'team@myteam.com' }
  s.source           = { :git => '', :version => s.version.to_s }
  s.ios.deployment_target = '17.2'
  s.macos.deployment_target = '10.15'
  # Framework linking is handled by Flutter tooling, not CocoaPods.
  # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
  s.vendored_frameworks = 'path/to/nothing'
end